I just want let you know I made a first attempt to run GWEN in ORX.
Here you can find original GEWN project:
Here's my fork on BitBucket (mercurial) with the addition of the renderer, input handler and sample application (orxEngine):
Here's a screenshot of the sample application running GWEN inside ORX:
And now...let's come to problems.
I need a better way to handle mouse and keyboard inputs.
As of now I mapped all inputs in the ini file and I'm Handling orxINPUT_EVENTs.
What I'd like to have is a quicker way to get events of key/mouse events (maybe direcly from GLFW callback) bypassing the ORX input system and avoiding polling.
That would lead to a faster response in input handling.
Do you have any advice?
It would be nice to have an orxDisplay_DrawText and an orxDisplay_MeasureText to use with precharged fonts.
For now I'll use the default font used by GWEN OpenGL_DebugFont implementation.
My intention is exactly to build tool for orx.
As of now I'm trying to use orx font system using a modified version of orxFontGen to let to generate fonts at runtime and only in memory.
I added to my repository the original version of Gwen Designer, an application that can build ui interfaces for Gwen and import/export UI files (in JSON)
Actually it works only with DirectX9 and Allegro but my plan, after terminating the font stuff, is to build the Designer using orx and let the designer to become a library used inside my tool.
After that we'll have a nice system to build complex UI for games or tools inside ORX.
You will expect a pair of libraries, one dedicated to usage of GWEN with a little help for integration (orxGwen??) and the other is the designer library (orxGewnDesigner??) that will contain only the designer to show it inside your apps.
...and if you want, give me some help.
I'm not an OpenGL guru and I'm not an ORX guru.
Here's what I need someone else to do:
- Build the current GWEN project for Linux and Mac and test my ORX integration
- Take a look at the code and understand if, to your knowledge, there's a better way to handle inputs and texture drawing.
- Build a patch for orx to add orxDisplay_DrawText and an orxDisplay_MeasureText (maybe I'll make it but if someone want to do it before me...i'll be glad )
There's only a problem about painting left panel (don't know why it's black) but I did not have enought time to debug.
You can find the ViewportControl in orxGwen::Controls...ehm...it's the only custom control I created
Halted development of font related stuff because as of now I don't badly need it and I have other goals to reach.
Hi ainvar, nice to see you around and sorry for the late answer, I was traveling.
I had a quick look at the code yesterday, but I'll clone it to have a deeper look at it in the coming days.
I'm definitely not the target audience but it does look promising!
From what I gathered from your code, you're actually not polling but listening to the input events instead.
As for the inputs themselves, I'm not sure why you need to link them like this one-to-one. It seems like it'd make user-defined shortcuts much harder to handle, unless this part is done with gwen?
You can also bind the inputs programmatically if you prefer, it should be pretty straightforward.
I'm not sure what you mean by "faster response in input handling". The GLFW events are sent when glfw's PollEvent function is called by orx at the beginning of each clock tick. The input events are sent right after that, in the same clock tick, still before any logic or object update is done, so you wouldn't see any difference.
orxDisplay_TransformText() and orxText_GetSize() might be what you want. If not, in which way should they be modified to suit your needs?
I hope you reached a nice and relaxing place for your vacation!
What I've done may be it's the result of my misunderstanding about orx input management.
GWEN needs only to get typed characters (InputCharacter) and special keys like CTRL, ALT, UP, DOWN, etc...(InputKey).
Should I call orxKeyboard_ReadString and then call the appropriate GWEN function to send received characters?
And for special keys? Should I check them with orxKeyboard_ReadKey or orsKeyboard_IsPressed?
And for text rendering...well...I missed the two functions you proposed
I'll check better how to use them to draw text in GWEN.
I'll keep this thread updated as soon as I add new features.
Yep, went back home. Too bad I injured my left knee a week before leaving and won't be able to enjoy the ocean. Ah well!
orxKeyboard_ReadString() and orxKeyboard_ReadKey() might definitely be what you want. The first one will give you all the characters as a utf-8 string (I use it for the interactive console if you want to check the code). The second one should give you all the key presses in order they were sent, *including* regular letter keys as well.
The difference being that with ReadString() you get actual text as handled by the keyboard layout the users has set (including capitalization, accentuation, ...), whereas the second one send you the plain key.
Well lemme know if you encounter any problem with them, then.