summaryrefslogtreecommitdiffstats
path: root/tools/render-test/window.h
blob: e647a602c60d6c0a7a6bd20314d7f3125761519e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// window.h
#pragma once

#include <slang.h>
#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