reepblue Posted 3 hours ago Posted 3 hours ago I've noticed that when using window->KeyHit() if you hold down the key, the function will keep returning true. My solution for this problem is to poll the input events myself but that's not an ideal solution. Hold down the space key in this example and it should rapidly change the panel's colors. //------------------------------------------------------------------------------------------------- // // This example uses the space key to control the color of a panel widget. // //------------------------------------------------------------------------------------------------- #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create windows auto window = CreateWindow("Leadwerks", 0, 0, 800, 600, displays[0]); //Create user interface auto ui = CreateInterface(window); while (true) { if (window->KeyHit(KEY_SPACE)) { ui->root->SetColor(Random(1.0f), Random(1.0f), Random(1.0f), 1); } const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: return 0; break; } } return 0; } Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon!
Josh Posted 2 hours ago Posted 2 hours ago When I run this example and hold down the space key the window color only changes once. 1 Quote Let's build cool stuff and have fun.
reepblue Posted 2 hours ago Author Posted 2 hours ago I'll do more investigating. I'm just recalling a bug I encountered in my project but there was also a quite a bit going on. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.