video/wiiu: Start adding "events" stuff

This commit is contained in:
Ash Logan
2019-01-03 09:38:17 +11:00
parent 817cf209ec
commit 56088fbaf2
3 changed files with 79 additions and 8 deletions

View File

@@ -0,0 +1,52 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_VIDEO_DRIVER_WIIU
#include <stdbool.h>
#include <whb/proc.h>
// for SDL_SendQuit
#include "../../events/SDL_events_c.h"
static bool proc_init = false;
void WIIU_PumpEvents(_THIS) {
if (proc_init) {
bool running = WHBProcIsRunning();
if (!running) {
SDL_SendQuit();
proc_init = false;
}
}
}
void WIIU_EventsInit() {
WHBProcInit();
proc_init = true;
}
void WIIU_EventsShutdown() {
WHBProcShutdown();
}
#endif

View File

@@ -0,0 +1,24 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
void WIIU_PumpEvents(_THIS);
void WIIU_EventsInit();
void WIIU_EventsShutdown();

View File

@@ -33,6 +33,7 @@
#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_keyboard_c.h"
#include "SDL_wiiuvideo.h"
#include "SDL_wiiuevents_c.h"
#include <gfd.h>
#include <gx2/draw.h>
@@ -41,7 +42,6 @@
#include <gx2/registers.h>
#include <gx2r/draw.h>
#include <gx2r/buffer.h>
#include <whb/proc.h>
#include <whb/gfx.h>
#include <coreinit/memdefaultheap.h>
#include <string.h>
@@ -52,7 +52,6 @@
static int WIIU_VideoInit(_THIS);
static int WIIU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
static void WIIU_VideoQuit(_THIS);
static void WIIU_PumpEvents(_THIS);
static int WIIU_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
static int WIIU_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects);
static void WIIU_DestroyWindowFramebuffer(_THIS, SDL_Window *window);
@@ -93,7 +92,7 @@ static int WIIU_VideoInit(_THIS)
SDL_DisplayMode mode;
void *buffer = NULL;
WHBProcInit();
WIIU_EventsInit();
WHBGfxInit();
// setup shader
@@ -133,7 +132,7 @@ static void WIIU_VideoQuit(_THIS)
GX2RDestroyBufferEx(&tex_coord_buffer, 0);
wiiuFreeTextureShader();
WHBGfxShutdown();
WHBProcShutdown();
WIIU_EventsShutdown();
}
static int WIIU_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
@@ -244,10 +243,6 @@ static int WIIU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode
return 0;
}
static void WIIU_PumpEvents(_THIS)
{
}
static int WIIU_Available(void)
{
return 1;