ghoflvhxj
-
Posts
76 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by ghoflvhxj
-
-
2 hours ago, Josh said:
This is occurring because the button gets draw onto the GUI base widget when it is created, but since the base widget has no script it does not get redrawn when the button changes, leaving an area of "corrupt" pixels. The solution is to add the panel script to the base widget. You can make it completely transaparent with alpha and it will be invislbe, but it will still clean up the old pixels:
#include "App.h" //#include "Player.h" using namespace Leadwerks; App::App() : window(nullptr), context(nullptr), world(nullptr), camera(nullptr){} App::~App() { delete world; delete context; delete window; } bool App::Start() { window = Leadwerks::Window::Create("test", 400, 0); context = Leadwerks::Context::Create(window); world = Leadwerks::World::Create(); camera = Leadwerks::Camera::Create(); gui = Leadwerks::GUI::Create(context); gui->GetBase()->SetScript("Scripts/GUI/Panel.lua"); gui->GetBase()->SetObject("backgroundcolor", new Vec4(0.0, 0.0, 0.0, 0.0)); Leadwerks::Widget* btn = Leadwerks::Widget::Button("btn_test 1", 0, 0, 100, 100, gui->GetBase()); btn->SetString("style", "Link"); btn->SetAlignment(1, 0, 0, 0); Leadwerks::Widget* panel = Leadwerks::Widget::Panel(200, 200, 400, 100, gui->GetBase()); Leadwerks::Widget* btn2 = Leadwerks::Widget::Button("btn_test 2", 100, 50, 100, 100, panel); btn2->SetString("style", "Link"); return true; } bool App::Loop() { if (window->KeyHit(Leadwerks::Key::Escape)) return false; camera->SetClearColor(0.0, 0.0, 1.0); camera->SetDebugPhysicsMode(false); if (window->KeyDown(Leadwerks::Key::F)) camera->SetDebugPhysicsMode(true); Leadwerks::Time::Update(); world->Update(); world->Render(); context->Sync(true); return true; }
In the default script, the panel has 0.5 alpha so it creates a dark overlay on the 3D scene.
thank you josh!
-
4 hours ago, GorzenDev said:
gui->GetBase() will give you the base widget which is usually the size of the entire window.
a position of 100, 100 with base as parent will end up 100, 100 in the window.
but a position of 100, 100 with panel as parent will end up 100 + panelX, 100 + panelY inside your window.
as for the Link button everything looks like it should.
a Link button ignores any style or text align so wanting to center a link widget will have to manually reposition it.
in my honest opinion do not use Link unless you actually want it to act like a Link.
i'm talk about something different you said.
look this image.
if i made 'link' button which parent set to 'base', general button appear.
but i set 'link' button's parent to panel it appear good. no general button.
i want to know how to disappear that.
-
-
I think i did what Josh said.
this code make 'Link' button in scripts/menu.lua
local gui = GUI:Create(context) --Create a link button GameMenu.newbutton = Widget:Button("NEW GAME",100,gui:GetBase():GetSize().y/2-60,300,20,gui:GetBase()) GameMenu.newbutton:SetString("style","Link") GameMenu.newbutton:SetAlignment(1,0,0,0) GameMenu.options = Widget:Button("OPTIONS",100,gui:GetBase():GetSize().y/2-10,300,20,gui:GetBase()) GameMenu.options:SetString("style","Link") GameMenu.options:SetAlignment(1,0,0,0) GameMenu.quit = Widget:Button("QUIT",100,gui:GetBase():GetSize().y/2+40,300,20,gui:GetBase()) GameMenu.quit:SetString("style","Link") GameMenu.quit:SetAlignment(1,0,0,0)
i write this code in c++.gui = Leadwerks::GUI::Create(Leadwerks::Context::GetCurrent()); Leadwerks::Widget* base = gui->GetBase(); btn_start = Leadwerks::Widget::Button("start", 100, 100, 100, 50, base); btn_start->SetString("style", "Link");
Could i know what i did worng?
-
gui = Leadwerks::GUI::Create(Leadwerks::Context::GetCurrent()); Leadwerks::Widget* base = gui->GetBase(); btn_start = Leadwerks::Widget::Button("start", 100, 100, 100, 50, base); btn_start->SetString("style", "Link");
hi.
I'm trying to make UI that will apply to my game. but, it does not work out from beginning. haha
I had make simple 'Link' button. but it looks wrong. how can i fix it?
I would appreciate your reply.
-
On 5/2/2018 at 11:38 AM, macklebee said:
It would be a lot easier if we had code to review and try for ourselves. The video is nice as it shows what the effects of the issue but doesn't help us see what you are doing wrong. Show us your pick code. Or better yet, make a small example map and available code that we can easily try.
ok, here is my code.
bool Player::Pick() { //if player grab the entity, return true. if (pick_state == PICK_UP) return true; pick_state = PICK_EMPTY; pick_image = nullptr; if (!camera->Pick(context_halfwidth, context_halfheight, pickinfo)) return false; pick = pickinfo.GetEntity(); std::cout << pick->GetClassNameA() << " " << classname << std::endl; std::cout << pick->GetPhysicsMode() << " " << physics << std::endl; std::cout << pick->GetCollisionType() << " " << collision << std::endl; if (window->KeyDown(Leadwerks::Key::R)) { Leadwerks::Vec3 a = Leadwerks::Transform::Point(pickinfo.position, pick, nullptr); t->SetPosition(a); } //Check classname, physicsmode, collisiontype if (pick->GetClassNameA() != "Model" || pick->GetPhysicsMode() != Leadwerks::Entity::RigidBodyPhysics || pick->GetCollisionType() != Leadwerks::Collision::Prop) return false; //Check distance and mass if (pick->GetDistance(character) > pick_distance_limit || pick->GetMass() > pick_mass_limit) return false; pick_state = PICK_PICK; pick_image = hand_pick; return true; }
void Player::PickUp() { //Check distance if (pick->GetDistance(character) > pick_distance_limit) { PickInit(); return; } //if the entity's first pick if (pick_state == PICK_PICK) { pick_mass = pick->GetMass(); //Transformation of the pick position from localspace to globalspace. Leadwerks::Vec3 pick_pos = Leadwerks::Transform::Point(pickinfo.position, pick, nullptr); //Create joint pick_joint = Leadwerks::Joint::Kinematic(pick_pos.x, pick_pos.y, pick_pos.z, pick); pick_joint->SetFriction(1000, 10000 - pick_mass * pick_mass * 10); joint_target_pos_gap = pick->GetPosition(true) - pick_pos; } else { Leadwerks::Vec3 camera_target_pos = camera_pivot->GetPosition(false); camera_target_pos.z += 1.2; camera_target_pos = Leadwerks::Transform::Point(camera_target_pos, camera_pivot, nullptr); //Joint work Leadwerks::Vec3 joint_target_pos = camera_target_pos + joint_target_pos_gap; pick_joint->SetTargetPosition(joint_target_pos, 1.0f - (pick_mass * 2.0)/100); } pick_state = PICK_UP; pick_image = hand_grab; }
Additionally, the ClassName of the entities in the video are "Model", "PhysicsMode" is "RigidBodyPhysics" and "CollisionType" is "Prop".
And, the entitiy that did not 'pick' from 10 to 25 seconds of video were 'pick' after the collision at 27sec.
-
Hello guys. please look this video.
I could not pick some entities. why?
-
On 2018. 3. 8. at 5:30 PM, Josh said:
When your game is run from the editor a command line argument is passed with information for the Lua debugger. Since you are running straight from Visual Studio there is no such information, but it's not a problem.
This does not occur in the release build.
ok thank you
-
-
Hi guys.
I joined the army because Korean army is conscription.
I wuold discharge after 20 months.
Although I enlisted, I would not give up the dream of creating a game.
See you later.
-
You can render your text to an image and load that, then draw the image on screen.
Thank you Josh.
Perhaps, Leadwerks Engine is there any plan to support Hangul font?
-
Hi guys.
I tried to add some font(korean) in my project a few hours ago but i didn't get good result.
I think leadwerks engine doesn't surpport korean font.
What can i do to use korean font?
-
Thank you.
self.enemy.script:SetMode("dying")
-
Hi guys.
I was making a trigger which, lead to death of an object, if collision with it occur.
For example, there is a variable named 'health' in the MonsterAI.lua.
i wrote SimpleTrigger.lua like this.
Script.Enemy1pfb = "" --path "Enemy1" " Pfb file (.*pfb):pfb|Prefabs
-----------------------------------------------------------------------------------------
self.enemy = Prefab::Load(self.Enemy1pfb)
self.enemy.health = 0
Loading was perfect but i could not access to health.
What should ㅑ do?
-
how are you reading the value of force? if memory serves, its a Vec3 in that function.
Thanks for your reply.
By the way, Did you know why speed parameter have 0?
-
I use EntityCollisionCallback function to embody falling damage.
Like this.
void _stdcall EntityCollisionCallback(TEntity entity0, TEntity entity1, byte* position, byte* normal, byte* force, flt speed) { ... } SetEntityCallback(controller,(byte*)EntityCollisionCallback,ENTITYCALLBACK_COLLISION);
But, "force" and "speed" parameter have only 0.
Not to get 0 What can i do?
-
Sorry, i'm not good at english.
i'll explain more detail.
um..
physcis did not move when animate door open, close frame.
-
-
Ah! very thanks!
-
Hello guys.
A few days ago i purchased 'ultimate unwrap 3d' and got some plugins.
I think Leadwerks plugin will export .gmf file but .mdl file.
I can't use this file format because i'm LE2 user.
Is there some way to use .mdl file in LE2?
-
How did you get this effect with the emitter? Really nice smokey look. I am trying to get some fog in LE3, I don't think the emitter would be the right thing to use though.
I use emitter which in LE2
One, I guess hacky but it'll work, way to do this is to make triggers in certain areas that will turn on/off emitters. For example if you walked up stairs to this floor, you could have a trigger that would disable that emitter below and enable the one above. You can control this via the flowgraph easy enough.
Ok, i understand.
thanks Rick
-
If I understood him correctly, then what he is trying to avoid is that emitter piercing the floor and coming from below. If you have two hallways stacked on top of each other and each has a particle emitter in it then at some viewing angles you will be able to see particles seeping through the floor. Actually I would also want to know what's the best way to avoid that.
Yeah, I want to say "aviod piercing"!
I tell you if i will find good way.
-
Do you want to remove it? Or does it look bad?
I want to avoid piercing floor:)
-
world->clear() and camera
in General Discussion
Posted
asd