ORX and GWEN

edited July 2015 in Projects - Tools
Hi people,

I just want let you know I made a first attempt to run GWEN in ORX.

Here you can find original GEWN project:
https://github.com/garrynewman/GWEN

Here's my fork on BitBucket (mercurial) with the addition of the renderer, input handler and sample application (orxEngine):
https://bitbucket.org/ainvar/gwen


Here's a screenshot of the sample application running GWEN inside ORX:
gwen_orx.png


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?

Comments

  • edited July 2015
    On current implementation an important thing is missing and that's using ORX to render texts.

    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.
  • edited July 2015
    This is fantastic for building Orx tools within orx and making use of the config. Nice work, ainvar.
  • edited July 2015
    Thank you sausage!

    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.

    So...stay tuned!!...

    ...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 :) )
  • edited July 2015
    I compiled the Designer with orx (with some modifications) and it seems to be working.
    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.
  • edited August 2015
    I modified orxGwenTest and created a ViewportControl that can take care of an orxVIEWPORT so it's easier to use orxVIEWPORTs in your tools.
    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.
  • edited August 2015
    ainvar wrote:
    Hi people,

    I just want let you know I made a first attempt to run GWEN in ORX.

    Here you can find original GEWN project:
    https://github.com/garrynewman/GWEN

    Hi ainvar, nice to see you around and sorry for the late answer, I was traveling.
    Here's my fork on BitBucket (mercurial) with the addition of the renderer, input handler and sample application (orxEngine):
    https://bitbucket.org/ainvar/gwen

    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.
    Here's a screenshot of the sample application running GWEN inside ORX:
    gwen_orx.png

    I'm definitely not the target audience but it does look promising!

    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.

    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.
    That would lead to a faster response in input handling.
    Do you have any advice?

    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.
    On current implementation an important thing is missing and that's using ORX to render texts.

    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.

    orxDisplay_TransformText() and orxText_GetSize() might be what you want. If not, in which way should they be modified to suit your needs?
  • edited August 2015
    No problem for the delay!
    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.

    Bye bye
  • edited August 2015
    ainvar wrote:
    No problem for the delay!
    I hope you reached a nice and relaxing place for your vacation!

    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!
    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?

    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.
    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.

    Well lemme know if you encounter any problem with them, then. :)
Sign In or Register to comment.