sdlwindow.cpp

main 176 lines · 2.8 KB Raw
Alex Alex Commit Client Upload Part 2 19/10/2026 00:06
1#if defined(__EMSCRIPTEN__)
2
3#include <framework/core/eventdispatcher.h>
4#include "sdlwindow.h"
5
6SDLWindow::SDLWindow()
7{
8 m_minimumSize = Size(640, 360);
9 m_size = Size(640, 360);
10 m_eglDisplay = EGL_NO_DISPLAY;
11 m_eglContext = EGL_NO_CONTEXT;
12 m_eglSurface = EGL_NO_SURFACE;
13}
14
15SDLWindow::~SDLWindow()
16{
17 internalDestroyGL();
18}
19
20
21void SDLWindow::internalInitGL()
22{
23
24}
25
26void SDLWindow::internalDestroyGL()
27{
28
29}
30
31void SDLWindow::internalCheckGL()
32{
33
34}
35
36void SDLWindow::internalChooseGL()
37{
38
39}
40
41void SDLWindow::internalCreateGLContext()
42{
43
44}
45
46void SDLWindow::internalDestroyGLContext()
47{
48 /*
49 if (m_window == NULL)
50 return;
51
52 if(m_eglDisplay) {
53 eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
54
55 if (m_eglSurface) {
56 eglDestroySurface(m_eglDisplay, m_eglSurface);
57 m_eglSurface = EGL_NO_SURFACE;
58 }
59
60 if(m_eglContext) {
61 eglDestroyContext(m_eglDisplay, m_eglContext);
62 m_eglContext = EGL_NO_CONTEXT;
63 }
64
65 eglTerminate(m_eglDisplay);
66 m_eglDisplay = EGL_NO_DISPLAY;
67 } */
68}
69
70void SDLWindow::internalConnectGLContext()
71{
72 /*
73 m_eglSurface = eglCreateWindowSurface(m_eglDisplay, m_eglConfig, m_window, NULL);
74 if(m_eglSurface == EGL_NO_SURFACE)
75 g_logger.fatal(stdext::format("Unable to create EGL surface: %s", eglGetError())); */
76}
77
78void SDLWindow::terminate()
79{
80 //nativePause();
81}
82
83void SDLWindow::poll()
84{
85
86}
87
88void SDLWindow::swapBuffers()
89{
90
91}
92
93void SDLWindow::setVerticalSync(bool enable)
94{
95 //eglSwapInterval(m_eglDisplay, enable ? 1 : 0);
96}
97
98std::string SDLWindow::getClipboardText()
99{
100 // TODO
101 return "";
102}
103
104void SDLWindow::setClipboardText(const std::string& text)
105{
106 // TODO
107}
108
109Size SDLWindow::getDisplaySize()
110{
111 return m_size;
112}
113
114std::string SDLWindow::getPlatformType()
115{
116 return "WASM";
117}
118
119void SDLWindow::init() {}
120
121void SDLWindow::show() {}
122
123void SDLWindow::hide() {}
124
125void SDLWindow::maximize() {}
126
127void SDLWindow::minimize() {}
128
129void SDLWindow::move(const Point& pos) {}
130
131void SDLWindow::resize(const Size& size) {}
132
133void SDLWindow::showMouse() {}
134
135void SDLWindow::hideMouse() {}
136
137void SDLWindow::setMouseCursor(int cursorId) {}
138
139void SDLWindow::restoreMouseCursor() {}
140
141void SDLWindow::setTitle(const std::string& title) {}
142
143void SDLWindow::setMinimumSize(const Size& minimumSize) {}
144
145void SDLWindow::setFullscreen(bool fullscreen) {}
146
147void SDLWindow::setIcon(const std::string& iconFile) {}
148
149
150void SDLWindow::updateSize()
151{
152
153}
154
155
156void SDLWindow::handleTextInput(std::string text)
157{
158
159}
160
161void SDLWindow::showTextEditor(const std::string& title, const std::string& description, const std::string& text, int flags)
162{
163
164}
165
166void SDLWindow::displayFatalError(const std::string& message)
167{
168
169}
170
171void SDLWindow::openUrl(std::string url)
172{
173
174}
175
176#endif
Top