90 lines
1.8 KiB
C++
90 lines
1.8 KiB
C++
|
|
#ifndef PLATFORM_WIN32_DISPLAY_H
|
|
#define PLATFORM_WIN32_DISPLAY_H
|
|
|
|
#include "Win32GLContext.h"
|
|
#include <Platform/PlatformDisplay.h>
|
|
#include <cstdint>
|
|
#include <Windows.h>
|
|
|
|
namespace sp {
|
|
|
|
class Win32Display : public PlatformDisplay
|
|
{
|
|
public :
|
|
Win32Display();
|
|
virtual ~Win32Display();
|
|
|
|
virtual bool create(DisplayDescription description);
|
|
|
|
virtual void destroy();
|
|
|
|
virtual bool isValid();
|
|
|
|
virtual void* getHandle() const;
|
|
|
|
virtual void setSize(unsigned int width, unsigned int height);
|
|
|
|
virtual Vector2u getSize() const;
|
|
|
|
virtual void setPosition(unsigned int x, unsigned int y);
|
|
|
|
virtual Vector2u getPosition() const;
|
|
|
|
virtual void setVisible(bool visible);
|
|
|
|
virtual void setDecoration(unsigned decoration);
|
|
|
|
virtual void enterFullscreen(DisplayMode mode);
|
|
|
|
virtual void exitFullscreen();
|
|
|
|
virtual void minimize();
|
|
|
|
virtual void maximize();
|
|
|
|
virtual void setCaption(const std::string& caption);
|
|
|
|
virtual void setIcon(unsigned int width, unsigned int height, const uint8_t *pixels);
|
|
|
|
virtual void showCursor(bool value);
|
|
|
|
virtual void grabCursor(bool value);
|
|
|
|
protected :
|
|
|
|
void registerClass();
|
|
|
|
DWORD getWin32Flags(unsigned int flags);
|
|
|
|
Vector2i centerWindow(int width, int height);
|
|
|
|
void processMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
|
|
|
void processResizeMessage(const Vector2u& new_size);
|
|
|
|
static LRESULT CALLBACK staticWndProc(HWND handle, UINT message, WPARAM wParam, LPARAM lParam);
|
|
|
|
protected :
|
|
|
|
HWND m_handle;
|
|
|
|
HCURSOR m_cursor;
|
|
|
|
HICON m_icon;
|
|
|
|
// True if this window is in a resize loop.
|
|
bool m_inResizeModalLoop;
|
|
|
|
// Client area size. cached here to check if a resize has been made.
|
|
Vector2u m_size;
|
|
|
|
Vector2u m_minSize;
|
|
|
|
// Fullscreen mode.
|
|
DisplayMode m_fs_mode;
|
|
};
|
|
|
|
} // namespace sp
|
|
|
|
#endif /* PLATFORM_WIN32_DISPLAY_H */
|