mirror of https://github.com/libsdl-org/SDL.git
Harmony port: entrypoint
This commit is contained in:
parent
04e80426fb
commit
d4039d3d66
|
|
@ -139,6 +139,15 @@ void OHOS_UnlockPage()
|
|||
SDL_UnlockMutex(g_ohosPageMutex);
|
||||
}
|
||||
|
||||
int OHOS_FetchWidth()
|
||||
{
|
||||
return wid;
|
||||
}
|
||||
int OHOS_FetchHeight()
|
||||
{
|
||||
return hei;
|
||||
}
|
||||
|
||||
static napi_value minus(napi_env env, napi_callback_info info)
|
||||
{
|
||||
size_t argc = 2;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ void OHOS_windowDataFill(SDL_Window* w);
|
|||
void OHOS_removeWindow(SDL_Window* w);
|
||||
void OHOS_LockPage();
|
||||
void OHOS_UnlockPage();
|
||||
int OHOS_FetchWidth();
|
||||
int OHOS_FetchHeight();
|
||||
|
||||
typedef struct SDL_VideoData {
|
||||
SDL_Rect textRect;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#include "SDL3/SDL_pixels.h"
|
||||
#include "SDL3/SDL_video.h"
|
||||
#include "SDL_internal.h"
|
||||
#include "../SDL_sysvideo.h"
|
||||
|
||||
|
|
@ -9,6 +11,20 @@
|
|||
|
||||
bool OHOS_VideoInit(SDL_VideoDevice *_this)
|
||||
{
|
||||
_this->num_displays = 1;
|
||||
SDL_DisplayMode mode;
|
||||
SDL_zero(mode);
|
||||
mode.format = SDL_PIXELFORMAT_RGBA32;
|
||||
mode.w = OHOS_FetchWidth();
|
||||
mode.h = OHOS_FetchHeight();
|
||||
mode.refresh_rate = 60;
|
||||
|
||||
SDL_DisplayID displayID = SDL_AddBasicVideoDisplay(&mode);
|
||||
if (displayID == 0) {
|
||||
return false;
|
||||
}
|
||||
_this->displays = SDL_calloc(1, sizeof(SDL_VideoDisplay*));
|
||||
_this->displays[0] = SDL_GetVideoDisplay(displayID);
|
||||
return true;
|
||||
}
|
||||
void OHOS_VideoQuit(SDL_VideoDevice *_this)
|
||||
|
|
@ -33,7 +49,6 @@ static SDL_VideoDevice *OHOS_CreateDevice(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
device->num_displays = 1;
|
||||
device->internal = data;
|
||||
device->free = OHOS_DeviceFree;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue