Cole Chapman Posted July 22, 2011 Posted July 22, 2011 Couple questions. 1. Am I correct in saying that it would be faster for my program to render 2d GUI instead of 3D? (3D Being making a cube or a plane and adding textures to those) 2. Will it work just as fast programming GUI in BlitzMax(What I am using) than it would be to program it in LUA and run scripts? 3. As far as code, I am still working on it and I may get this done before anyone posts, but if not... What is the code for having a window (in this case a rectangle) move with the mouse if the mouse is clicked? So far I have: Method DrawWindow() DrawRect x,y,w,h If MouseDown(1) Then If (MouseX() > x And MouseX() < x+w) And (MouseY() > y And MouseY() < y+h) Then Local MouseFromX:Int = MouseX() - x Local MouseFromY:Int = MouseY() - y Repeat Local XPos:Int = MouseX() - MouseFromX Local YPos:Int = MouseY() - MouseFromY x=XPos y=YPos Until MouseDown(1) = False EndIf EndIf End Method With that code, I used the repeat so it wouldnt declare MouseFromX and MouseFromY again, however, being stuck in that loop stops the rendering so that wont be able to work. Is there a way to declare those once and not have it declared again until a new MouseClick occurs? Quote
Canardia Posted July 22, 2011 Posted July 22, 2011 1) Both can be faster or slower at certain things. Rendering a 3D texture is slower than just displaying 2D text, but then againg movin a 3D window is much faster than moving a 2D window. 2) Bmx, Lua, C++, anything goes and will be fast enough, it's the GPU which is the bottleneck. 3) That's just a question of plain logic. I suggest you write it down on paper how it should behave, and get away from the computer, because the computer disturbs thinking with all its subcognicious distractions. As a hint: basically you can make it very simple by working with boolean flags. Have a flag for if mouse started drag action on window, if mouse was released while drag action was active, etc.... Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■
Cole Chapman Posted July 22, 2011 Author Posted July 22, 2011 Haha well thank you very much for the response! I figured out that I could declare a variable saying MouseFromX and MouseFromY is already declared and that could work. But I know from looking at it right now, that I would completely have to rewrite (If MouseDown on THIS GUI Object) because currently if I added lets say a button, it would think I am clicking on the button as well as the window. I will sit down right now and think about all of this. Thanks again! ah, was posting this while you edited, yeah boolean is what ill have to do ^^, thanks man Quote
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.