Select Git revision
WindowManager.h
Forked from
einsteinathome / graphicsframework
277 commits behind the upstream repository.
-
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...
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_*/