Jordan Bonser
  • Home
  • CV
  • University Work
    • Second Year Work >
      • Top-Down Shooter
    • Third Year Work >
      • Terrain Analysis Project >
        • Terrain Analysis Tool
        • Game Demonstration
      • Post Processing
      • Android Application - Sports Centre
  • Projects
    • Unity Development >
      • Lerpz Tutorial
      • Dare to be Digital Entry - "Lit"
      • Unity Game
    • Geometry Instancing
    • Road to Eldorado
    • Level Editor
    • OpenGL Work
    • JBEngine
  • Blog
  • Tutorials
    • Flask Session Timeout

Development Blog

JBEngine: GUI Progression

24/1/2014

0 Comments

 
I have been working solely on the GUI aspect of my work for a while and have now come up with what is hopefully close to a final implementation. I've had to deal with issues to do with working in different spaces. i.e. converting from Mouse Co-ordinates and manipulating texture co-ordinates to finally get the final image in clip space co-ordinates. It has been tough and taken a few iterations to get it all right. 

I finally have a semi-finished example showing the use of GUI Buttons, Layovers and Text:

One of the more difficult decisions I made was deciding how to do the events for the GUI elements such as OnClickEvent. After doing some searching around I settled on using a C++ 11 feature the std::function. The important aspect of this feature is that it allows you to store a reference to a member function. Here is an example of how it is used: 
 //Create a function object for member function for this instance 
function<void()> myOnClickFnc = bind( &MyClass::FunctionName, this );
//Then Set the OnClickFunction for my GuiElement
button->SetOnClickEvent( myOnClickFnc );
The main advantage of this is that it is now fairly easy for any class to set their own member functions to work as the event function for an element and it is much safer than using normal function pointers. The std::function does still work for normal functions and also static class functions, the only difference is that you wouldn't need to use the "bind()" function. so it would simply be:
 //Create a function object for static class function
function<void()> myOnClickFnc = &MyStaticClass::FunctionName;
or:
 //Create a function object for function 
function<void()> myOnClickFnc = &functionName;
//Then Set the OnClickFunction for my GuiElement
button->SetOnClickEvent( myOnClickFnc );
I have read online that this new feature can be quite slow although at the moment I haven't noticed any performance issues and as a general rule a GUI isn't as performance critical as other parts of a game.

This project is really coming along and I am now looking to tidy up some bits and really design how the "Engine" will be exposed to the user.

Keep coding :)
0 Comments



Leave a Reply.

    Archives

    May 2020
    April 2020
    January 2020
    November 2019
    October 2019
    September 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    August 2018
    July 2018
    June 2018
    March 2018
    January 2018
    June 2017
    February 2017
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    February 2016
    January 2016
    December 2015
    November 2015
    September 2015
    August 2015
    July 2015
    June 2015
    March 2015
    January 2015
    November 2014
    October 2014
    September 2014
    August 2014
    July 2014
    June 2014
    May 2014
    February 2014
    January 2014
    December 2013
    November 2013
    October 2013
    July 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    January 2013
    December 2012
    October 2012
    September 2012
    August 2012
    July 2012
    June 2012
    May 2012

    Categories

    All
    2D
    3rd Year Project
    Agile
    Android
    Angular
    Animation
    API
    Apple
    Apps
    Arden
    Async
    Awesomium
    C#
    CI/CD
    Clean Code
    CMake
    Cocos2d-x
    Colour Match
    Compilers
    Cross Compiling
    Cross-Compiling
    Databases
    Design
    Development Tools
    Docker
    Electronics
    Examples
    Flask
    Flask-Login
    Fmod
    Game Development
    Godot
    GUI
    Hackathon
    Hacktoberfest
    Hardware
    Home Life
    IBM
    Inspired Gaming
    Instancing
    Ios
    Javascript
    Jbengine
    Kata
    Level Editor
    Linux
    Microsoft
    Mobile Development
    Monogame
    Moodster
    Motivation
    Networking
    Objective C
    Opengl
    Open Source
    Organisation
    Physics
    Physx
    Pi
    Planning
    Post Mortem
    PyGame
    Python
    Quart
    Quasar
    RakNet
    React
    Road To Eldoarado
    Scripting
    Scrum Master
    Sessions
    Session Timeout
    Social
    Sound
    Space Invaders
    Squash Game
    Squash Game
    Streaming
    TDD
    Team Leading
    Test
    Test Driven Development
    Travis
    Unity
    Unity Development
    VSCode
    Vulkan
    Web Applications
    Worklife
    WSL
    XML
    XNA / C#

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • Home
  • CV
  • University Work
    • Second Year Work >
      • Top-Down Shooter
    • Third Year Work >
      • Terrain Analysis Project >
        • Terrain Analysis Tool
        • Game Demonstration
      • Post Processing
      • Android Application - Sports Centre
  • Projects
    • Unity Development >
      • Lerpz Tutorial
      • Dare to be Digital Entry - "Lit"
      • Unity Game
    • Geometry Instancing
    • Road to Eldorado
    • Level Editor
    • OpenGL Work
    • JBEngine
  • Blog
  • Tutorials
    • Flask Session Timeout