Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed FLTK dependencies from headless stage #86

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

dkargin
Copy link
Contributor

@dkargin dkargin commented Nov 27, 2017

I've made some work to separate simulation part from FLTK.

I've separated libstage to two separate libraries: libstage-core and libstage. libstage-core implements headless simulation, and now it contains no references to FLTK. libstage includes libstage-core and FLTK implementation for GUI.

There are also two variants of executables: 'legacy' stage and stage-headless. Legacy variant works the same, with -gui option. stage-headless can only be headless, without any GUI.

Things that I have refactored to make it work:

  • Canvas now wraps most rendering routines, instead of calling FLTK GL utilities. FLTK-specific routines are implemented in CanvasFLTK class.
  • Menu and option system. I've stripped GUI code from Option class. All menu-related things are localized in MenuManager class. FLTK part implements MenuManagerFLTK, that links to CanvasFLTK to populate a menu
  • All rendering methods get a pointer to active canvas. No need to keep a pointer to world class, just to obtain canvas pointer in rendering pipeline. It would help to implement multi canvas rendering as well.
  • Image loading is localized in Image class. It uses libpng to load images. I haven't seen non-png bitmaps in world folder. Though I can consider making a more complex management of image loaders, allowing FLTK-based stage version to register additional fltk image loader.

I've separated gui-specific code to libstage-gui library, so base simulation does not need fltk anymore.

Now stage compiles two executables: stage and stage-headless. Headless variant does not needs FLTK

Fixed most of compiler errors. Linker to be fixed
Introduced MenuManager class. It descendants should deal with adding options to actuial GUI implementation

All model drawing functions now get a pointer to Canvas instance. No more need to kep a pointer to world data just to get Canvas from it (after another dynamic_cast)

And many more cleaning as well

Code compiles now
Fixed image loading
Reworkrd World::Run a bit. Now there is separate WorldGui::Run for scenes with gui support
Old libstage with FLTK-GUI remains the same. Now there is libstage_core, that works without FLTK
Stripped Push/PopColor from Model class. Model often obtains direct pointer to canvas, so it can call this methods directly

Added explicit 'override' keywords for overriden methods. Now we strongly need c++11

Updated CMakeLists.txt and stage-config to properly install headers for GUI
All classes should use void DataVisualize(Camera *cam, Canvas* canvas) signature.
Seems like I've missed camera and blinkenlight during my fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant