91 lines
1.6 KiB
C++
91 lines
1.6 KiB
C++
|
|
#ifndef SPECTRE_DISPLAY_DISPLAY_H
|
|
#define SPECTRE_DISPLAY_DISPLAY_H
|
|
|
|
#include "DisplayMode.h"
|
|
#include "DisplayDescription.h"
|
|
#include <Spectre/Math/Vector2.h>
|
|
#include <Spectre/Display/GLContext.h>
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
namespace sp {
|
|
|
|
class PlatformDisplay;
|
|
class GLContext;
|
|
|
|
class Display
|
|
{
|
|
friend class PlatformDisplay;
|
|
public :
|
|
enum Mode {
|
|
WINDOWED = 0,
|
|
FULLSCREEN = 1,
|
|
WINDOWEDFULLSCREEN = 2,
|
|
};
|
|
|
|
public :
|
|
Display();
|
|
virtual ~Display();
|
|
|
|
bool create(DisplayDescription decription);
|
|
|
|
void destroy();
|
|
|
|
void setSize(unsigned int width, unsigned int height);
|
|
|
|
void setCaption(const std::string& title);
|
|
|
|
const std::string& getCaption() const;
|
|
|
|
void setIcon(const std::string& filename);
|
|
|
|
void setIcon(unsigned int width, unsigned int height, const uint8_t *pixels);
|
|
|
|
void setDisplayMode(const DisplayMode& mode);
|
|
|
|
const DisplayMode& getDisplayMode() const;
|
|
|
|
void setVideoMode(Mode mode);
|
|
|
|
enum Mode getVideoMode() const;
|
|
|
|
void setVisible(bool visible);
|
|
|
|
void showCursor(bool value);
|
|
|
|
void grabCursor(bool value);
|
|
|
|
bool activate(bool value);
|
|
|
|
// Enable/Disable Vertical Sync.
|
|
bool enableVSync(bool value);
|
|
|
|
void swapBuffers();
|
|
|
|
protected :
|
|
|
|
void init();
|
|
|
|
void onReshape(int width, int height);
|
|
|
|
protected :
|
|
enum Mode m_fmode;
|
|
|
|
// Cache window position when entering fullscreen
|
|
// So it can be restored when returning to window mode.
|
|
Vector2u m_cachePos;
|
|
|
|
DisplayDescription m_description;
|
|
DisplayDescription m_cacheDesc;
|
|
|
|
std::string m_caption;
|
|
|
|
PlatformDisplay* m_impl;
|
|
|
|
GLContext* m_context;
|
|
};
|
|
|
|
} // namepsace sp
|
|
|
|
#endif /* SPECTRE_DISPLAY_DISPLAY_H */
|