sdlwindow.h

main 82 lines · 1.9 KB Raw
Alex Alex Commit Client Upload Part 2 19/10/2026 00:06
1#ifndef ANDROID_WINDOW_H
2#define ANDROID_WINDOW_H
3
4#include "platformwindow.h"
5
6class SDLWindow : public PlatformWindow {
7 enum EventType {
8 TOUCH_DOWN,
9 TOUCH_UP,
10 TOUCH_MOTION,
11 TOUCH_LONGPRESS,
12 KEY_DOWN,
13 KEY_UP,
14 TEXTINPUT,
15 EVENT_UNDEFINED
16 };
17
18 enum NativeMessage {
19 RECREATE_CONTEXT,
20 APP_TERMINATE
21 };
22
23 void internalInitGL();
24 void internalDestroyGL();
25
26 void internalCheckGL();
27 void internalChooseGL();
28 void internalCreateGLContext();
29 void internalDestroyGLContext();
30 void internalConnectGLContext();
31
32
33public:
34 SDLWindow();
35 ~SDLWindow();
36
37 void init();
38 void terminate();
39 void move(const Point& pos);
40 void resize(const Size& size);
41 void show();
42 void hide();
43 void minimize();
44 void maximize();
45 void poll();
46 void swapBuffers();
47 void showMouse();
48 void hideMouse();
49
50 void setMouseCursor(int cursorId);
51 void restoreMouseCursor();
52
53 void setTitle(const std::string& title);
54 void setMinimumSize(const Size& minimumSize);
55 void setFullscreen(bool fullscreen);
56 void setVerticalSync(bool enable);
57 void setIcon(const std::string& iconFile);
58 void setClipboardText(const std::string& text);
59
60 Size getDisplaySize();
61 std::string getClipboardText();
62 std::string getPlatformType();
63
64 void displayFatalError(const std::string& message) override;
65 void showTextEditor(const std::string& title, const std::string& description, const std::string& text, int flags) override;
66
67 void updateSize();
68 void handleTextInput(std::string text);
69 void openUrl(std::string url);
70
71protected:
72 int internalLoadMouseCursor(const ImagePtr& image, const Point& hotSpot) override { return -1; };
73
74private:
75 EGLConfig m_eglConfig;
76 EGLContext m_eglContext;
77 EGLDisplay m_eglDisplay;
78 EGLSurface m_eglSurface;
79 InputEvent m_multiInputEvent[3];
80};
81
82#endif
Top