From c2e5d2468ad6a38cdb8a067da0678302f6cc6066 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 13 Sep 2019 15:59:15 -0400 Subject: Refactor render-test to make cross platform (#1053) * First pass of render-test refactor. * Make window construction a function that can choose an implementation. * Remove OpenGL as currently has windows dependency. * Disable Vulkan as Renderer impl has dependency on windows. * Pass Window in as parameter of 'update'. * Add win-window.cpp as was missing. * Fix warning on windows about signs during comparison. --- tools/render-test/window.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tools/render-test/window.h (limited to 'tools/render-test/window.h') diff --git a/tools/render-test/window.h b/tools/render-test/window.h new file mode 100644 index 000000000..e647a602c --- /dev/null +++ b/tools/render-test/window.h @@ -0,0 +1,45 @@ +// window.h +#pragma once + +#include +#include "../../source/core/slang-smart-pointer.h" + +namespace renderer_test { + +class Window; + +class WindowListener : public Slang::RefObject +{ +public: + virtual SlangResult update(Window* window) = 0; +}; + +class Window : public Slang::RefObject +{ +public: + virtual SlangResult initialize(int width, int height) = 0; + + virtual void show() = 0; + virtual void* getHandle() const = 0; + virtual void postQuit() { m_isQuitting = true; } + + /// Run the event loop. Events will be sent to the WindowListener + virtual SlangResult runLoop(WindowListener* listener) = 0; + + bool isQuitting() const { return m_isQuitting; } + int getQuitValue() const { return m_quitValue; } + + static Window* create(); + + virtual ~Window() {} + +protected: + Window() {} + + bool m_isQuitting = false; + int m_quitValue = 0; +}; + +Window* createWindow(); + +} // renderer_test -- cgit v1.2.3