1
0
Fork 0

Rename Display to Window.

It makes more sense to be consistent and always call it window.
This commit is contained in:
Henrik Hautakoski 2023-08-22 07:12:47 +02:00
parent 416a71f744
commit 24da7f45e0
33 changed files with 257 additions and 255 deletions

View file

@ -1,34 +0,0 @@
#ifndef SPECTRE_DISPLAY_DISPLAYDESCRIPTION_H
#define SPECTRE_DISPLAY_DISPLAYDESCRIPTION_H
#include "DisplayMode.h"
namespace sp {
namespace DisplayDecorate {
enum Type {
Empty = 0,
Menu = 1 << 0,
Resize = 1 << 1,
Close = 1 << 2,
Default = Menu | Resize | Close,
};
};
struct DisplayDescription
{
public :
DisplayDescription();
DisplayDescription(DisplayMode mode, unsigned decoration = DisplayDecorate::Default);
public :
DisplayMode mode;
unsigned int decoration;
};
} // namespace sp
#endif /* SPECTRE_DISPLAY_DISPLAYDESCRIPTION_H */

View file

@ -3,7 +3,7 @@
#define GRAPHICS_H
#include <Spectre/GfxDriver/GfxDriver.h>
#include <Spectre/Display/Display.h>
#include <Spectre/Window/Window.h>
namespace sp {
@ -31,7 +31,7 @@ public :
std::string getVersion() const;
void setDisplayMode(Display::Mode mode);
void setWindowMode(Window::Mode mode);
void setSize(int width, int height);
@ -45,14 +45,14 @@ public :
GfxDriver* getDriver();
Display* getDisplay();
Window* getWindow();
protected :
int m_width;
int m_height;
Display *m_display;
Window *m_window;
// Graphics Driver. OpenGL/Vulcan/DirectX etc.
GfxDriver *m_gfxdrv;

View file

@ -7,7 +7,7 @@
namespace sp {
class Display;
class Window;
struct Event
{
@ -43,7 +43,7 @@ public :
struct SizeEvent
{
Display *display;
Window *window;
int width;
int height;
};
@ -62,7 +62,7 @@ public :
// Helper methods
static Event createSize(Display *display, int width, int height);
static Event createSize(Window *window, int width, int height);
static Event createKey(Keyboard::Key code, bool pressed);

View file

@ -8,12 +8,12 @@
namespace sp {
class Display;
class Window;
class EventListener
{
public :
virtual void onSizeChanged(Display* display, int width, int height);
virtual void onSizeChanged(Window* window, int width, int height);
virtual void onEvent(const Event& event);
};

View file

@ -15,7 +15,7 @@ public :
void unregisterListener(EventListener *listener);
virtual void onSizeChanged(Display* display, int width, int height);
virtual void onSizeChanged(Window* window, int width, int height);
virtual void onEvent(const Event& event);

View file

@ -1,12 +1,12 @@
#ifndef DISPLAY_GLCONTEXT_H
#define DISPLAY_GLCONTEXT_H
#ifndef SPECTRE_WINDOW_GLCONTEXT_H
#define SPECTRE_WINDOW_GLCONTEXT_H
#include <Spectre/Math/Vector2.h>
namespace sp {
class PlatformDisplay;
class PlatformWindow;
// Platform independant interface for OpenGL Contexts.
@ -17,8 +17,8 @@ public :
virtual ~GLContext();
// Create a GLContext for this perticular display.
virtual bool create(const PlatformDisplay* display) = 0;
// Create a GLContext for this perticular window.
virtual bool create(const PlatformWindow* window) = 0;
virtual void destroy() = 0;
@ -44,4 +44,4 @@ public :
} // namespace sp
#endif /* DISPLAY_GLCONTEXT_H */
#endif /* SPECTRE_WINDOW_GLCONTEXT_H */

View file

@ -1,22 +1,22 @@
#ifndef SPECTRE_DISPLAY_DISPLAY_H
#define SPECTRE_DISPLAY_DISPLAY_H
#ifndef SPECTRE_WINDOW_WINDOW_H
#define SPECTRE_WINDOW_WINDOW_H
#include "DisplayMode.h"
#include "DisplayDescription.h"
#include "WindowDescription.h"
#include <Spectre/Math/Vector2.h>
#include <Spectre/Display/GLContext.h>
#include <Spectre/Window/GLContext.h>
#include <cstdint>
#include <string>
namespace sp {
class PlatformDisplay;
class PlatformWindow;
class GLContext;
class Display
class Window
{
friend class PlatformDisplay;
friend class PlatformWindow;
public :
enum Mode {
WINDOWED = 0,
@ -25,10 +25,10 @@ public :
};
public :
Display();
virtual ~Display();
Window();
virtual ~Window();
bool create(DisplayDescription decription);
bool create(WindowDescription decription);
void destroy();
@ -78,16 +78,16 @@ protected :
// So it can be restored when returning to window mode.
Vector2u m_cachePos;
DisplayDescription m_description;
DisplayDescription m_cacheDesc;
WindowDescription m_description;
WindowDescription m_cacheDesc;
std::string m_caption;
PlatformDisplay* m_impl;
PlatformWindow* m_impl;
GLContext* m_context;
};
} // namepsace sp
#endif /* SPECTRE_DISPLAY_DISPLAY_H */
#endif /* SPECTRE_WINDOW_WINDOW_H */

View file

@ -0,0 +1,34 @@
#ifndef SPECTRE_WINDOW_WINDOWDESCRIPTION_H
#define SPECTRE_WINDOW_WINDOWDESCRIPTION_H
#include "DisplayMode.h"
namespace sp {
namespace WindowDecorate {
enum Type {
Empty = 0,
Menu = 1 << 0,
Resize = 1 << 1,
Close = 1 << 2,
Default = Menu | Resize | Close,
};
};
struct WindowDescription
{
public :
WindowDescription();
WindowDescription(DisplayMode mode, unsigned decoration = WindowDecorate::Default);
public :
DisplayMode mode;
unsigned int decoration;
};
} // namespace sp
#endif /* SPECTRE_WINDOW_WINDOWDESCRIPTION_H */