mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 03:25:14 -04:00
Change window handle to a union
This commit is contained in:
parent
f07c13c02a
commit
a422564bc7
3
.github/workflows/build_psp.yml
vendored
3
.github/workflows/build_psp.yml
vendored
@ -22,6 +22,7 @@ jobs:
|
|||||||
id: compile
|
id: compile
|
||||||
run: |
|
run: |
|
||||||
apk add curl curl-dev
|
apk add curl curl-dev
|
||||||
|
export PSPSDK=$(psp-config --pspsdk-path)
|
||||||
make psp
|
make psp
|
||||||
|
|
||||||
|
|
||||||
@ -49,4 +50,4 @@ jobs:
|
|||||||
if: ${{ always() && steps.compile.outcome == 'success' }}
|
if: ${{ always() && steps.compile.outcome == 'success' }}
|
||||||
with:
|
with:
|
||||||
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
|
DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
|
||||||
WORKFLOW_NAME: 'psp'
|
WORKFLOW_NAME: 'psp'
|
||||||
|
@ -20,6 +20,8 @@ ifeq ($(strip $(PSPSDK)),)
|
|||||||
$(warning "Please set PSPSDK variables in your environment. For example:")
|
$(warning "Please set PSPSDK variables in your environment. For example:")
|
||||||
$(warning export PSPSDK=/usr/local/pspsk/psp/sdk)
|
$(warning export PSPSDK=/usr/local/pspsk/psp/sdk)
|
||||||
$(warning export PATH=/usr/local/pspsk/bin:$$PATH)
|
$(warning export PATH=/usr/local/pspsk/bin:$$PATH)
|
||||||
|
$(warning Or)
|
||||||
|
$(warning export PSPSDK=$$(shell psp-config --pspsdk-path))
|
||||||
$(error Failed to find PSPSDK installation)
|
$(error Failed to find PSPSDK installation)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -392,9 +392,9 @@ static cc_result Music_PlayOgg(struct Stream* source) {
|
|||||||
#ifdef CC_BUILD_ANDROID
|
#ifdef CC_BUILD_ANDROID
|
||||||
/* Don't play music while in the background on Android */
|
/* Don't play music while in the background on Android */
|
||||||
/* TODO: Not use such a terrible approach */
|
/* TODO: Not use such a terrible approach */
|
||||||
if (!Window_Main.Handle) {
|
if (!Window_Main.Handle.ptr) {
|
||||||
Audio_Pause(&music_ctx);
|
Audio_Pause(&music_ctx);
|
||||||
while (!Window_Main.Handle && !music_stopping) {
|
while (!Window_Main.Handle.ptr && !music_stopping) {
|
||||||
Thread_Sleep(10); continue;
|
Thread_Sleep(10); continue;
|
||||||
}
|
}
|
||||||
Audio_Play(&music_ctx);
|
Audio_Play(&music_ctx);
|
||||||
|
@ -471,6 +471,7 @@ typedef cc_uint8 EntityID;
|
|||||||
typedef cc_uint8 Face;
|
typedef cc_uint8 Face;
|
||||||
typedef cc_uint32 cc_result;
|
typedef cc_uint32 cc_result;
|
||||||
typedef cc_uint64 TimeMS;
|
typedef cc_uint64 TimeMS;
|
||||||
|
typedef union cc_pointer_ { cc_uintptr val; void* ptr; } cc_pointer;
|
||||||
|
|
||||||
typedef struct Rect2D_ { int x, y, width, height; } Rect2D;
|
typedef struct Rect2D_ { int x, y, width, height; } Rect2D;
|
||||||
typedef struct TextureRec_ { float u1, v1, u2, v2; } TextureRec;
|
typedef struct TextureRec_ { float u1, v1, u2, v2; } TextureRec;
|
||||||
|
@ -399,7 +399,8 @@ static cc_bool CanDeleteTexture(struct Entity* except) {
|
|||||||
int i;
|
int i;
|
||||||
if (!except->TextureId) return false;
|
if (!except->TextureId) return false;
|
||||||
|
|
||||||
for (i = 0; i < ENTITIES_MAX_COUNT; i++) {
|
for (i = 0; i < ENTITIES_MAX_COUNT; i++)
|
||||||
|
{
|
||||||
if (!Entities.List[i] || Entities.List[i] == except) continue;
|
if (!Entities.List[i] || Entities.List[i] == except) continue;
|
||||||
if (Entities.List[i]->TextureId == except->TextureId) return false;
|
if (Entities.List[i]->TextureId == except->TextureId) return false;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ static void CreateDeviceAndSwapChain(void) {
|
|||||||
desc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
desc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||||
// RefreshRate intentionally left at 0 so display's refresh rate is used
|
// RefreshRate intentionally left at 0 so display's refresh rate is used
|
||||||
desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||||
desc.OutputWindow = Window_Main.Handle;
|
desc.OutputWindow = Window_Main.Handle.ptr;
|
||||||
desc.SampleDesc.Count = 1;
|
desc.SampleDesc.Count = 1;
|
||||||
desc.SampleDesc.Quality = 0;
|
desc.SampleDesc.Quality = 0;
|
||||||
desc.Windowed = TRUE;
|
desc.Windowed = TRUE;
|
||||||
|
@ -136,7 +136,7 @@ static cc_bool deviceCreated;
|
|||||||
static void TryCreateDevice(void) {
|
static void TryCreateDevice(void) {
|
||||||
cc_result res;
|
cc_result res;
|
||||||
D3DCAPS9 caps;
|
D3DCAPS9 caps;
|
||||||
HWND winHandle = (HWND)Window_Main.Handle;
|
HWND winHandle = (HWND)Window_Main.Handle.ptr;
|
||||||
D3DPRESENT_PARAMETERS args = { 0 };
|
D3DPRESENT_PARAMETERS args = { 0 };
|
||||||
D3D9_FillPresentArgs(&args);
|
D3D9_FillPresentArgs(&args);
|
||||||
|
|
||||||
|
@ -146,7 +146,6 @@ void Screen_PointerUp(void* s, int id, int x, int y);
|
|||||||
|
|
||||||
|
|
||||||
typedef void (*Widget_LeftClick)(void* screen, void* widget);
|
typedef void (*Widget_LeftClick)(void* screen, void* widget);
|
||||||
union WidgetMeta { int val; void* ptr; };
|
|
||||||
|
|
||||||
struct WidgetVTABLE {
|
struct WidgetVTABLE {
|
||||||
/* Draws this widget on-screen. */
|
/* Draws this widget on-screen. */
|
||||||
@ -184,7 +183,7 @@ struct WidgetVTABLE {
|
|||||||
cc_uint8 horAnchor, verAnchor; /* The reference point for when this widget is resized */ \
|
cc_uint8 horAnchor, verAnchor; /* The reference point for when this widget is resized */ \
|
||||||
int xOffset, yOffset; /* Offset from the reference point */ \
|
int xOffset, yOffset; /* Offset from the reference point */ \
|
||||||
Widget_LeftClick MenuClick; \
|
Widget_LeftClick MenuClick; \
|
||||||
union WidgetMeta meta;
|
cc_pointer meta;
|
||||||
|
|
||||||
/* Whether a widget is prevented from being interacted with */
|
/* Whether a widget is prevented from being interacted with */
|
||||||
#define WIDGET_FLAG_DISABLED 0x01
|
#define WIDGET_FLAG_DISABLED 0x01
|
||||||
|
@ -71,9 +71,9 @@ static CC_INLINE int Display_ScaleX(int x) { return (int)(x * DisplayInfo.ScaleX
|
|||||||
static CC_INLINE int Display_ScaleY(int y) { return (int)(y * DisplayInfo.ScaleY); }
|
static CC_INLINE int Display_ScaleY(int y) { return (int)(y * DisplayInfo.ScaleY); }
|
||||||
|
|
||||||
/* Data for a window */
|
/* Data for a window */
|
||||||
struct _WindowData {
|
struct cc_window {
|
||||||
/* Readonly platform-specific handle to the window. */
|
/* Readonly platform-specific handle to the window. */
|
||||||
void* Handle;
|
cc_pointer Handle;
|
||||||
/* Size of the content area of the window. (i.e. area that can draw to) */
|
/* Size of the content area of the window. (i.e. area that can draw to) */
|
||||||
/* This area does NOT include borders and titlebar surrounding the window. */
|
/* This area does NOT include borders and titlebar surrounding the window. */
|
||||||
int Width, Height;
|
int Width, Height;
|
||||||
@ -100,10 +100,10 @@ struct _WindowData {
|
|||||||
#define DEFAULT_UI_SCALE_Y (1.0f / 480)
|
#define DEFAULT_UI_SCALE_Y (1.0f / 480)
|
||||||
|
|
||||||
/* Data for the game/launcher window */
|
/* Data for the game/launcher window */
|
||||||
CC_VAR extern struct _WindowData WindowInfo; /* Named WindowInfo for backwards compatibility */
|
CC_VAR extern struct cc_window WindowInfo; /* Named WindowInfo for backwards compatibility */
|
||||||
#define Window_Main WindowInfo
|
#define Window_Main WindowInfo
|
||||||
/* Data for alternate game window (e.g. 3DS) */
|
/* Data for alternate game window (e.g. 3DS) */
|
||||||
extern struct _WindowData Window_Alt;
|
extern struct cc_window Window_Alt;
|
||||||
|
|
||||||
/* Initialises necessary state before initing platform and loading options */
|
/* Initialises necessary state before initing platform and loading options */
|
||||||
void Window_PreInit(void);
|
void Window_PreInit(void);
|
||||||
|
@ -19,8 +19,8 @@ static u16 top_width, top_height;
|
|||||||
static u16 btm_width, btm_height;
|
static u16 btm_width, btm_height;
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
struct _WindowData Window_Alt;
|
struct cc_window Window_Alt;
|
||||||
cc_bool launcherTop;
|
cc_bool launcherTop;
|
||||||
|
|
||||||
void Window_PreInit(void) {
|
void Window_PreInit(void) {
|
||||||
|
@ -158,7 +158,8 @@ static void JNICALL java_processSurfaceCreated(JNIEnv* env, jobject o, jobject s
|
|||||||
Platform_LogConst("WIN - CREATED");
|
Platform_LogConst("WIN - CREATED");
|
||||||
win_handle = ANativeWindow_fromSurface(env, surface);
|
win_handle = ANativeWindow_fromSurface(env, surface);
|
||||||
winCreated = true;
|
winCreated = true;
|
||||||
Window_Main.Handle = win_handle;
|
|
||||||
|
Window_Main.Handle.ptr = win_handle;
|
||||||
RefreshWindowBounds();
|
RefreshWindowBounds();
|
||||||
/* TODO: Restore context */
|
/* TODO: Restore context */
|
||||||
Event_RaiseVoid(&WindowEvents.Created);
|
Event_RaiseVoid(&WindowEvents.Created);
|
||||||
@ -168,8 +169,9 @@ static void JNICALL java_processSurfaceDestroyed(JNIEnv* env, jobject o) {
|
|||||||
Platform_LogConst("WIN - DESTROYED");
|
Platform_LogConst("WIN - DESTROYED");
|
||||||
if (win_handle) ANativeWindow_release(win_handle);
|
if (win_handle) ANativeWindow_release(win_handle);
|
||||||
|
|
||||||
win_handle = NULL;
|
win_handle = NULL;
|
||||||
Window_Main.Handle = NULL;
|
Window_Main.Handle.ptr = NULL;
|
||||||
|
|
||||||
/* eglSwapBuffers might return EGL_BAD_SURFACE, EGL_BAD_ALLOC, or some other error */
|
/* eglSwapBuffers might return EGL_BAD_SURFACE, EGL_BAD_ALLOC, or some other error */
|
||||||
/* Instead the context is lost here in a consistent manner */
|
/* Instead the context is lost here in a consistent manner */
|
||||||
if (Gfx.Created) Gfx_LoseContext("surface lost");
|
if (Gfx.Created) Gfx_LoseContext("surface lost");
|
||||||
|
@ -349,10 +349,10 @@ static void DoCreateWindow(int width, int height) {
|
|||||||
BRect frame(x, y, x + width - 1, y + height - 1);
|
BRect frame(x, y, x + width - 1, y + height - 1);
|
||||||
win_handle = new CC_BWindow(frame);
|
win_handle = new CC_BWindow(frame);
|
||||||
|
|
||||||
Window_Main.Exists = true;
|
Window_Main.Exists = true;
|
||||||
Window_Main.Handle = win_handle;
|
Window_Main.Handle.ptr = win_handle;
|
||||||
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
||||||
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
||||||
|
|
||||||
frame = win_handle->Bounds();
|
frame = win_handle->Bounds();
|
||||||
Window_Main.Width = frame.IntegerWidth() + 1;
|
Window_Main.Width = frame.IntegerWidth() + 1;
|
||||||
|
@ -16,7 +16,7 @@ static cc_bool launcherMode;
|
|||||||
cc_bool window_inited;
|
cc_bool window_inited;
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
void Window_PreInit(void) {
|
void Window_PreInit(void) {
|
||||||
vid_set_mode(DEFAULT_VID_MODE, DEFAULT_PIXEL_MODE);
|
vid_set_mode(DEFAULT_VID_MODE, DEFAULT_PIXEL_MODE);
|
||||||
|
@ -23,7 +23,7 @@ static void* xfb;
|
|||||||
static GXRModeObj* rmode;
|
static GXRModeObj* rmode;
|
||||||
void* Window_XFB;
|
void* Window_XFB;
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
|
|
||||||
static void OnPowerOff(void) {
|
static void OnPowerOff(void) {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
static cc_bool launcherMode;
|
static cc_bool launcherMode;
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
void Window_PreInit(void) {
|
void Window_PreInit(void) {
|
||||||
display_init(RESOLUTION_320x240, DEPTH_32_BPP, 2, GAMMA_NONE, FILTERS_DISABLED);
|
display_init(RESOLUTION_320x240, DEPTH_32_BPP, 2, GAMMA_NONE, FILTERS_DISABLED);
|
||||||
|
@ -130,7 +130,7 @@ static int bg_id;
|
|||||||
static u16* bg_ptr;
|
static u16* bg_ptr;
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
void Window_PreInit(void) {
|
void Window_PreInit(void) {
|
||||||
videoSetModeSub(MODE_0_2D);
|
videoSetModeSub(MODE_0_2D);
|
||||||
|
@ -27,7 +27,7 @@ static cc_bool launcherMode;
|
|||||||
static char pad_buff[2][34];
|
static char pad_buff[2][34];
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
void Window_PreInit(void) { }
|
void Window_PreInit(void) { }
|
||||||
void Window_Init(void) {
|
void Window_Init(void) {
|
||||||
|
@ -29,7 +29,8 @@ static char padBuf0[256] __attribute__((aligned(64)));
|
|||||||
static char padBuf1[256] __attribute__((aligned(64)));
|
static char padBuf1[256] __attribute__((aligned(64)));
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
framebuffer_t fb_colors[2];
|
framebuffer_t fb_colors[2];
|
||||||
zbuffer_t fb_depth;
|
zbuffer_t fb_depth;
|
||||||
static int display_mode;
|
static int display_mode;
|
||||||
|
@ -25,7 +25,7 @@ static KbData kb_data;
|
|||||||
static KbConfig kb_config;
|
static KbConfig kb_config;
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
static void sysutil_callback(u64 status, u64 param, void* usrdata) {
|
static void sysutil_callback(u64 status, u64 param, void* usrdata) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
static cc_bool launcherMode;
|
static cc_bool launcherMode;
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
void Window_PreInit(void) {
|
void Window_PreInit(void) {
|
||||||
sceCtrlSetSamplingCycle(0);
|
sceCtrlSetSamplingCycle(0);
|
||||||
|
@ -17,7 +17,7 @@ static cc_bool launcherMode;
|
|||||||
static SceTouchPanelInfo frontPanel;
|
static SceTouchPanelInfo frontPanel;
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
#define DISPLAY_WIDTH 960
|
#define DISPLAY_WIDTH 960
|
||||||
#define DISPLAY_HEIGHT 544
|
#define DISPLAY_HEIGHT 544
|
||||||
|
@ -89,10 +89,10 @@ static void DoCreateWindow(int width, int height, int flags) {
|
|||||||
if (!win_handle) Window_SDLFail("creating window");
|
if (!win_handle) Window_SDLFail("creating window");
|
||||||
|
|
||||||
RefreshWindowBounds();
|
RefreshWindowBounds();
|
||||||
Window_Main.Exists = true;
|
Window_Main.Exists = true;
|
||||||
Window_Main.Handle = win_handle;
|
Window_Main.Handle.ptr = win_handle;
|
||||||
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
||||||
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
||||||
|
|
||||||
Window_Main.SoftKeyboardInstant = true;
|
Window_Main.SoftKeyboardInstant = true;
|
||||||
ApplyIcon();
|
ApplyIcon();
|
||||||
|
@ -73,10 +73,10 @@ static void DoCreateWindow(int width, int height, int flags) {
|
|||||||
SDL_DestroyProperties(props);
|
SDL_DestroyProperties(props);
|
||||||
|
|
||||||
RefreshWindowBounds();
|
RefreshWindowBounds();
|
||||||
Window_Main.Exists = true;
|
Window_Main.Exists = true;
|
||||||
Window_Main.Handle = win_handle;
|
Window_Main.Handle.ptr = win_handle;
|
||||||
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
||||||
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
||||||
|
|
||||||
Window_Main.SoftKeyboardInstant = true;
|
Window_Main.SoftKeyboardInstant = true;
|
||||||
ApplyIcon();
|
ApplyIcon();
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
static cc_bool launcherMode;
|
static cc_bool launcherMode;
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
static void OnVblank(void* work) {
|
static void OnVblank(void* work) {
|
||||||
smpc_peripheral_intback_issue();
|
smpc_peripheral_intback_issue();
|
||||||
|
@ -21,7 +21,7 @@ static PadState pad;
|
|||||||
static AppletHookCookie cookie;
|
static AppletHookCookie cookie;
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
static void SetResolution(void) {
|
static void SetResolution(void) {
|
||||||
// check whether the Switch is docked
|
// check whether the Switch is docked
|
||||||
@ -66,18 +66,18 @@ void Window_Init(void) {
|
|||||||
DisplayInfo.ScaleX = 1;
|
DisplayInfo.ScaleX = 1;
|
||||||
DisplayInfo.ScaleY = 1;
|
DisplayInfo.ScaleY = 1;
|
||||||
|
|
||||||
Window_Main.Focused = true;
|
Window_Main.Focused = true;
|
||||||
Window_Main.Exists = true;
|
Window_Main.Exists = true;
|
||||||
Window_Main.Handle = nwindowGetDefault();
|
Window_Main.Handle.ptr = nwindowGetDefault();
|
||||||
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
||||||
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
||||||
|
|
||||||
Window_Main.SoftKeyboard = SOFT_KEYBOARD_RESIZE;
|
Window_Main.SoftKeyboard = SOFT_KEYBOARD_RESIZE;
|
||||||
Input_SetTouchMode(true);
|
Input_SetTouchMode(true);
|
||||||
Gui_SetTouchUI(true);
|
Gui_SetTouchUI(true);
|
||||||
Input.Sources = INPUT_SOURCE_GAMEPAD;
|
Input.Sources = INPUT_SOURCE_GAMEPAD;
|
||||||
|
|
||||||
nwindowSetDimensions(Window_Main.Handle, 1920, 1080);
|
nwindowSetDimensions(Window_Main.Handle.ptr, 1920, 1080);
|
||||||
SetResolution();
|
SetResolution();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
|||||||
*-----------------------------------------------------OpenGL context------------------------------------------------------*
|
*-----------------------------------------------------OpenGL context------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
static void GLContext_InitSurface(void) {
|
static void GLContext_InitSurface(void) {
|
||||||
NWindow* window = (NWindow*)Window_Main.Handle;
|
NWindow* window = (NWindow*)Window_Main.Handle.ptr;
|
||||||
if (!window) return; /* window not created or lost */
|
if (!window) return; /* window not created or lost */
|
||||||
|
|
||||||
// terrible, but fixes 720p/1080p resolution change on handheld/docked modes
|
// terrible, but fixes 720p/1080p resolution change on handheld/docked modes
|
||||||
|
@ -425,7 +425,6 @@ void Window_Free(void) {
|
|||||||
|
|
||||||
static void DoCreateWindow(int width, int height) {
|
static void DoCreateWindow(int width, int height) {
|
||||||
Window_Main.Exists = true;
|
Window_Main.Exists = true;
|
||||||
Window_Main.Handle = (void*)1;
|
|
||||||
Window_Main.Focused = true;
|
Window_Main.Focused = true;
|
||||||
|
|
||||||
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
||||||
@ -523,10 +522,10 @@ cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Window_AllocFramebuffer(struct Bitmap* bmp, int width, int height) {
|
void Window_AllocFramebuffer(struct Bitmap* bmp, int width, int height) {
|
||||||
bmp->scan0 = (BitmapCol*)Mem_Alloc(width * height, 4, "window pixels");
|
bmp->scan0 = (BitmapCol*)Mem_Alloc(width * height, 4, "window pixels");
|
||||||
bmp->width = width;
|
bmp->width = width;
|
||||||
bmp->height = height;
|
bmp->height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
void Window_FreeFramebuffer(struct Bitmap* bmp) {
|
||||||
|
@ -33,8 +33,8 @@ extern "C" {
|
|||||||
static cc_bool launcherMode;
|
static cc_bool launcherMode;
|
||||||
static cc_bool keyboardOpen;
|
static cc_bool keyboardOpen;
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
struct _WindowData Window_Alt;
|
struct cc_window Window_Alt;
|
||||||
cc_bool launcherTop;
|
cc_bool launcherTop;
|
||||||
|
|
||||||
|
|
||||||
|
@ -394,10 +394,10 @@ static void DoCreateWindow(int width, int height) {
|
|||||||
win_DC = GetDC(win_handle);
|
win_DC = GetDC(win_handle);
|
||||||
if (!win_DC) Logger_Abort2(GetLastError(), "Failed to get device context");
|
if (!win_DC) Logger_Abort2(GetLastError(), "Failed to get device context");
|
||||||
|
|
||||||
Window_Main.Exists = true;
|
Window_Main.Exists = true;
|
||||||
Window_Main.Handle = win_handle;
|
Window_Main.Handle.ptr = win_handle;
|
||||||
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
||||||
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
||||||
|
|
||||||
grabCursor = Options_GetBool(OPT_GRAB_CURSOR, false);
|
grabCursor = Options_GetBool(OPT_GRAB_CURSOR, false);
|
||||||
}
|
}
|
||||||
|
@ -379,10 +379,10 @@ static void DoCreateWindow(int width, int height) {
|
|||||||
XkbSetDetectableAutoRepeat(win_display, true, &supported);
|
XkbSetDetectableAutoRepeat(win_display, true, &supported);
|
||||||
|
|
||||||
RefreshWindowBounds(width, height);
|
RefreshWindowBounds(width, height);
|
||||||
Window_Main.Exists = true;
|
Window_Main.Exists = true;
|
||||||
Window_Main.Handle = (void*)win_handle;
|
Window_Main.Handle.val = win_handle;
|
||||||
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
||||||
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
||||||
grabCursor = Options_GetBool(OPT_GRAB_CURSOR, false);
|
grabCursor = Options_GetBool(OPT_GRAB_CURSOR, false);
|
||||||
|
|
||||||
/* So right name appears in e.g. Ubuntu Unity launchbar */
|
/* So right name appears in e.g. Ubuntu Unity launchbar */
|
||||||
|
@ -20,7 +20,7 @@ static xid_dev_t* xid_ctrl;
|
|||||||
static xid_gamepad_in gp_state;
|
static xid_gamepad_in gp_state;
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
// TODO No idea if this even works
|
// TODO No idea if this even works
|
||||||
static void OnDataReceived(UTR_T* utr) {
|
static void OnDataReceived(UTR_T* utr) {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
static cc_bool launcherMode;
|
static cc_bool launcherMode;
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
static uint32_t reg_read32(int reg)
|
static uint32_t reg_read32(int reg)
|
||||||
{
|
{
|
||||||
|
@ -378,10 +378,10 @@ static void DoCreateWindow(int width, int height) {
|
|||||||
AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
|
AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
|
||||||
NewAEEventHandlerUPP(HandleQuitMessage), 0, false);
|
NewAEEventHandlerUPP(HandleQuitMessage), 0, false);
|
||||||
|
|
||||||
Window_Main.Exists = true;
|
Window_Main.Exists = true;
|
||||||
Window_Main.Handle = winHandle;
|
Window_Main.Handle.ptr = winHandle;
|
||||||
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
Window_Main.UIScaleX = DEFAULT_UI_SCALE_X;
|
||||||
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
Window_Main.UIScaleY = DEFAULT_UI_SCALE_Y;
|
||||||
// CGAssociateMouseAndMouseCursorPosition implicitly grabs cursor
|
// CGAssociateMouseAndMouseCursorPosition implicitly grabs cursor
|
||||||
|
|
||||||
del = [CCWindowDelegate alloc];
|
del = [CCWindowDelegate alloc];
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WindowData WindowInfo;
|
struct cc_window WindowInfo;
|
||||||
|
|
||||||
#define Display_CentreX(width) (DisplayInfo.x + (DisplayInfo.Width - width) / 2)
|
#define Display_CentreX(width) (DisplayInfo.x + (DisplayInfo.Width - width) / 2)
|
||||||
#define Display_CentreY(height) (DisplayInfo.y + (DisplayInfo.Height - height) / 2)
|
#define Display_CentreY(height) (DisplayInfo.y + (DisplayInfo.Height - height) / 2)
|
||||||
@ -115,7 +115,7 @@ static EGLint ctx_numConfig;
|
|||||||
static void GLContext_InitSurface(void); // replacement in Window_Switch.c for handheld/docked resolution fix
|
static void GLContext_InitSurface(void); // replacement in Window_Switch.c for handheld/docked resolution fix
|
||||||
#else
|
#else
|
||||||
static void GLContext_InitSurface(void) {
|
static void GLContext_InitSurface(void) {
|
||||||
void* window = Window_Main.Handle;
|
void* window = Window_Main.Handle.ptr;
|
||||||
if (!window) return; /* window not created or lost */
|
if (!window) return; /* window not created or lost */
|
||||||
ctx_surface = eglCreateWindowSurface(ctx_display, ctx_config, window, NULL);
|
ctx_surface = eglCreateWindowSurface(ctx_display, ctx_config, window, NULL);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user