Skip to content
Snippets Groups Projects
Select Git revision
  • a959216fb080ba6a113fc021b1c257ee850e7502
  • master default
  • mingw_gcc44
  • release_ABP1_012
  • release_ABP1_008
  • release_ABP1_006
  • release_ABP1_007
  • release_ABP1_005
  • release_ABP1_004
  • release_ABP1_003
  • pre_release_0.15
  • release_ABP1_001
  • release_ABP1_002
  • pre_release_0.13
  • pre_release_0.14
  • pre_release_0.11
  • pre_release_0.12
  • pre_release_0.10
  • pre_release_0.09
  • pre_release_0.08
20 results

WindowManager.h

Blame
  • Forked from einsteinathome / graphicsframework
    277 commits behind the upstream repository.
    • Oliver Bock's avatar
      3d9d9818
      Added proper timing · 3d9d9818
      Oliver Bock authored
      * For sphere rotation
      * For observatory positioning
      
      Note: the original code seems to have a bug which explains a slight discrepancy between this new and the original visualisation.
      In the original code gmt_dtime() is used to get the GMT time, but this function is a mere #define of dtime() under unix, hence any
      difference of dtime() and gmt_dtime() will result in 0 instead of the real UTC/GMT offset.
      
      Note: dtime() returns local time...
      3d9d9818
      History
      Added proper timing
      Oliver Bock authored
      * For sphere rotation
      * For observatory positioning
      
      Note: the original code seems to have a bug which explains a slight discrepancy between this new and the original visualisation.
      In the original code gmt_dtime() is used to get the GMT time, but this function is a mere #define of dtime() under unix, hence any
      difference of dtime() and gmt_dtime() will result in 0 instead of the real UTC/GMT offset.
      
      Note: dtime() returns local time...
    WindowManager.h 1.41 KiB
    #ifndef WINDOWMANAGER_H_
    #define WINDOWMANAGER_H_
    
    #include <iostream>
    #include <string>
    #include <list>
    #include <cassert>
    
    #include <SDL.h>
    
    #include <util.h>
    
    #include "AbstractGraphicsEngine.h"
    
    using namespace std;
    
    class WindowManager
    {
    public:
    	WindowManager();
    	virtual ~WindowManager();
    	
    	bool initialize(const int width = 1024, const int height = 768);
    	void registerEventObserver(AbstractGraphicsEngine *engine);
    	void unregisterEventObserver(AbstractGraphicsEngine *engine);
    	void eventLoop();
    	
    	int windowWidth() const;
    	int windowHeight() const;
    	
    	void setWindowCaption(const string caption) const;
    	void setWindowIcon(const string filename) const;
    	void toggleFullscreen();
    
    private:
        // FIXME: work around static, otherwise event conflict when more than one instance
        static Uint32 timerCallbackRenderEvent(Uint32 interval, void *param);
        static Uint32 timerCallbackBOINCUpdateEvent(Uint32 interval, void *param);
        
        int m_DesktopWidth;
        int m_DesktopHeight;
        int m_DesktopBitsPerPixel;
        int m_CurrentWidth;
        int m_CurrentHeight;
        int m_WindowedWidth;
        int m_WindowedHeight;
        Uint32 m_VideoModeFlags;
        
        bool m_FullscreenModeAvailable;
        bool m_WindowedModeAvailable;
        
        SDL_Surface *m_DisplaySurface;
        
        enum EventCodes {
            RenderEvent,
            BOINCUpdateEvent
        };
        
        list<AbstractGraphicsEngine *> eventObservers;
    };
    
    #endif /*WINDOWMANAGER_H_*/