File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,15 @@ void OHOS_UnlockPage()
139
139
SDL_UnlockMutex (g_ohosPageMutex );
140
140
}
141
141
142
+ int OHOS_FetchWidth ()
143
+ {
144
+ return wid ;
145
+ }
146
+ int OHOS_FetchHeight ()
147
+ {
148
+ return hei ;
149
+ }
150
+
142
151
static napi_value minus (napi_env env , napi_callback_info info )
143
152
{
144
153
size_t argc = 2 ;
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ void OHOS_windowDataFill(SDL_Window* w);
10
10
void OHOS_removeWindow (SDL_Window * w );
11
11
void OHOS_LockPage ();
12
12
void OHOS_UnlockPage ();
13
+ int OHOS_FetchWidth ();
14
+ int OHOS_FetchHeight ();
13
15
14
16
typedef struct SDL_VideoData {
15
17
SDL_Rect textRect ;
Original file line number Diff line number Diff line change
1
+ #include "SDL3/SDL_pixels.h"
2
+ #include "SDL3/SDL_video.h"
1
3
#include "SDL_internal.h"
2
4
#include "../SDL_sysvideo.h"
3
5
9
11
10
12
bool OHOS_VideoInit (SDL_VideoDevice * _this )
11
13
{
14
+ _this -> num_displays = 1 ;
15
+ SDL_DisplayMode mode ;
16
+ SDL_zero (mode );
17
+ mode .format = SDL_PIXELFORMAT_RGBA32 ;
18
+ mode .w = OHOS_FetchWidth ();
19
+ mode .h = OHOS_FetchHeight ();
20
+ mode .refresh_rate = 60 ;
21
+
22
+ SDL_DisplayID displayID = SDL_AddBasicVideoDisplay (& mode );
23
+ if (displayID == 0 ) {
24
+ return false;
25
+ }
26
+ _this -> displays = SDL_calloc (1 , sizeof (SDL_VideoDisplay * ));
27
+ _this -> displays [0 ] = SDL_GetVideoDisplay (displayID );
12
28
return true;
13
29
}
14
30
void OHOS_VideoQuit (SDL_VideoDevice * _this )
@@ -33,7 +49,6 @@ static SDL_VideoDevice *OHOS_CreateDevice(void)
33
49
return NULL ;
34
50
}
35
51
36
- device -> num_displays = 1 ;
37
52
device -> internal = data ;
38
53
device -> free = OHOS_DeviceFree ;
39
54
You can’t perform that action at this time.
0 commit comments