Jump to content

thehankinator

Members
  • Posts

    436
  • Joined

  • Last visited

Everything posted by thehankinator

  1. thehankinator

    GUI Design

    Have you thought about doing something with callbacks? You could have both lua and c++ UI code. I wrote a simple program to prove the concept, the end result is you could write c++ UI like this: Widget* Button = CreateWidget(); Button->Draw = std::bind(&MyDrawFunc); void MyDrawFunc() { std::cout << "MyDrawFunc" << std::endl; } Or with classes: class MyButton { public: MyButton() { Widget* Button = CreateWidget(); Button->Draw = std::bind(&MyButton::Draw, this); } void Draw() { std::cout << "MyButtonDraw" << std::endl; } }; MyButton mybutton; The for Lua you could do: function LuaDrawFunc() print("LuaDrawFunc") end button = Widget.Create() button:DrawCallback(LuaDrawFunc) or with a table: thing = {} function thing:ThingDraw() print("ThingDraw!") end thing.button = Widget:Create() thing.button:DrawCallback(thing.ThingDraw, thing)
  2. Ubuntu 14 LTS uses GCC 4.9.1 and Ubuntu 16 uses GCC 5.3.1, did you try downgrading to 4.9.1 (I don't know if you can)? It's a bad idea to mix different versions of GCC with Leadwerks because a number of function signatures use STL (mostly std::string but I've seen std::vector a few times), the underlying implementation of STL has likely changed between GCC releases.
  3. My library does a look up in a quadtree that contains all widgets that are visible. If there is something there, it sets a hover flag on the widget so it can draw a hover effect(or whatever).
  4. I think Josh would be the first to know if AMD has addressed the issue but it's been radio silence since May 16th so I doubt AMD has released a driver that addresses the issue. Refer to the "official" bug report rather than creating new threads http://www.leadwerks.com/werkspace/topic/14432-amd-msaa-1x-bug/page__st__80
  5. I'd check if Intel® Graphics Media Accelerator HD supports OpenGL 4, I doubt it. There might be a better tool but this will tell you what version it supports: http://www.realtech-vr.com/glview/download.php
  6. Have you tried changing the values you are using with SetCharacterControllerAngle? Like 0 instead of 180?
  7. I was able to update my item but a dialog box that says "Failed to update item" was displayed. However, if I check the item page it shows the update was successful.
  8. Have you tried playing with the Character Angle in the physics tab? It's in the screen shot about halfway down on this tutorial http://www.leadwerks.com/werkspace/page/tutorials/_/fps-character-controller-r23
  9. I get steady 60fps until I get outside the city and everything is in the scene, then it drops to steady 30fps. I think it might be due to vertical sync. If I just missed a vsync the system will wait as long as 16.6ms(assuming 60hz) for the next vsync. If I disable vsync I get about 53fps (dipping to ~48fps every now and then). FX 8120 and R9 380. vsync on vsync off
  10. What are you trying to achieve? When I tried your script, the game starts paused with your menu up. Something I noticed is that I placed paused = false in an unfortunate spot in Main.lua. I should have put it above loading the map. If you do that, to show the Pause menu when the game starts you can just put self:ShowMenu() at the end the Start() function in your script. The solution you have now is perfectly fine though.
  11. If you are using Autoscale, the THUI will scale whatever resolution you are set to. Anchor and Absolute will not (at this time anyway).
  12. Have you tried SetIntensity()? That's what the flicker script uses, worked for me. http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entitysetintensity-r163
  13. Is that whole thing in your Main.lua? If so, you've got the pause screen script combined with the Main.lua script. The second portion (starting with the second "import" line to the end) should go in it's own script and be assigned to a pivot in your level.
  14. This Main.lua does not have the changes required for the UI system to work. The Main.lua in Addons/THUI/Examples should have all the changes you need, Copy it your Scripts directory.
  15. I've been thinking about this for my UI library. It's an awkward problem that I've not found a perfect solution for but this might work for your use case.The following function will determine a font height so that it will fit in a box defined by w and h. It will start with the font at max size, if the text goes beyond the defined width, it will reduce the font size to fit. It loads a font every time you call it so I would call it only when text changes. function FontFit(fontpath, text, w, h) local font = Font:Load(fontpath, h) textwidth = font:GetTextWidth(text) font:Release() if textwidth > w then return h * (w / textwidth) else return h end end An example of loading a font that will fit some_text that will fit in an area of 100x30 local FontHeight = FontFit("Fonts/arial.ttf", some_text, 100, 30) local font = Font:Load("Fonts/arial.ttf", FontHeight)
  16. The below code: assert(false, "Why:Does this happen?") Gives the following result: "C:/Users/User/Documents/Leadwerks/Projects/MyGame/Addons/THUI/Core.lua" : 80 : Why If I simply don't use a colon it prints the whole string. What's the deal with the colon character? I don't see anything in PIL for this behavior https://www.lua.org/pil/8.3.html
  17. Would you post the code for your menu? I'll take a look.
  18. self is nil? Is it possible that the code calling this function uses a a dot instead of a colon? Blah.GetPosPiv() vs Blah:GetPosPiv()
  19. This might be a dumb question but how do you determine if a texture clashes with the geometry?
  20. Link to amd.zip is dead, I still have it from before, got it from http://leadwerks.com/amd.zip. Anyway, still broken. Details below:
  21. Tried to push an update to my UI library tonight, editor crashes every time. I'm on beta.
  22. I noticed my example used -90 and yours used 270 so I tried mine with 90/270 but still no luck. If I understand the update to SetInput correctly, I shouldn't need to play games with interpolating the angle to get the rotation to work. According to the updated reference for SetInput, setting maxrotationspeed to 0 should result in an instantaneous change to the requested angle. I might be misunderstanding the documentation but I think that my script should work. I'd love to use rigid body physics with SetRotation but then I'd have to implement my own pathing algorithm which seems like a lot of added work and complication when all that functionality already exists in LE it's just this one part that doesn't work and I think should.
  23. I probably should make the documentation more clear. The example Main should not be on a pivot, it would replace Main.lua in your scripts directory.
  24. That's what I get for not reading the post, my mistake.
×
×
  • Create New...