#pragma once #include "EHS.h" #include "Array.h" #include "Str.h" #include "Vec4.h" #include "BaseWindow.h" #include "HID/InputHandler.h" #define WM_HIDE (WM_APP + 1) #define WM_SHOW (WM_APP + 2) #define WM_HIDE_CURSOR (WM_APP + 3) #define WM_SHOW_CURSOR (WM_APP + 4) namespace ehs { class Window : public BaseWindow { private: UInt_32 owner; HINSTANCE instance; HWND hdl; static Array windows; static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); public: virtual ~Window() override; Window(); Window(const Window &win); Window& operator=(const Window &win); virtual bool Poll() override; ///Creates the native window. void Create_32(const Str_32& title, const Vec2_s32& pos, const Vec2_u32 scale) override; ///Creates the native window. void Create_16(const Str_16& title, const Vec2_s32& pos, const Vec2_u32 scale) override; ///Creates the native window. void Create_8(const Str_8& title, const Vec2_s32& pos, const Vec2_u32 scale) override; ///Uses an already existing window to render an overlay. void Use(HWND windowHdl); ///Closes the window. virtual void Close() override; ///Shows the window. void Show() override; ///Hides the window. void Hide() override; void SetTitle_32(const Str_32& title) override; Str_32 GetTitle_32(); void SetTitle_16(const Str_16& title) override; Str_16 GetTitle_16(); void SetTitle_8(const Str_8& title) override; Str_8 GetTitle_8(); void SetIcon(const Str_8& filePath); /// Sets the windows client scale. /// @param [in] w The width in pixels. /// @param [in] h The height in pixels. void SetClientSize(const Vec2& size); Vec2 GetClientSize(); /// Gets the windows native handle for the operating system or other native tasks. /// @returns The window's native handle. HWND GetHdl() const; /// Retrieves the first window handle that has been created using this library. /// @returns The window's native handle. static HWND GetAvailableHdl(); HINSTANCE GetInst() const; /// Toggles whether the window updates and renders. /// @param [in] toggle The new status. void ToggleEnabled(bool toggle); /// Checks whether the window updates and renders. /// @returns The current status. bool IsEnabled(); /// Sets the windows position on the desktop. /// @param [in] x The x axis in pixels. /// @param [in] y The y axis in pixels. void SetPos(int x, int y); /// Gets the windows current position on the desktop. /// @returns The current value. Vec2 GetPos(); virtual void OnResized(const Vec2& newSize); /// Sets the windows scale which includes the border. /// @param [in] w The width in pixels. /// @param [in] h The height in pixels. void SetSize(int w, int h); /// Gets the windows current scale. /// @returns The current value. Vec2 GetSize(); void ShowCursor(bool toggle) override; void ConstrainCursor(const bool toggle) override; protected: void SendMsg(const UINT msg, const WPARAM wParam, const LPARAM lParam); }; }