Author Topic: Moving UI Components  (Read 1165 times)

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Moving UI Components
« on: 6 December 2008, 14:44:00 »
I think components.cpp/h should be moved to the gui folder.

Also the rendering methods for components should be moved from the Renderer class to their component class. For example, Renderer::renderButton should be moved to GraphicButton::render. This should make it easier to replace with a GUI library and also makes calling simpler. ie in menu_state_root.cpp "renderer.renderButton(&buttonNewGame);" becomes "buttonNewGame.render();"

computeCenteredPos and Renderer::renderText should be moved to GraphicComponent class. renderText is called in Renderer::renderResourceStatus but other than that I couldn't see any problems moving the methods.

It might even be slightly quicker since it wouldn't need to call the getX() sort of methods, although, they might be inlined.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

 

anything