mirror of
https://github.com/yawut/SDL.git
synced 2026-07-08 20:54:39 -05:00
wiiu/video: move window data to header
This commit is contained in:
parent
162447e20b
commit
72a32e7ed4
|
|
@ -32,6 +32,7 @@
|
|||
#include "SDL_events.h"
|
||||
#include "../../events/SDL_mouse_c.h"
|
||||
#include "../../events/SDL_keyboard_c.h"
|
||||
#include "SDL_wiiuvideo.h"
|
||||
|
||||
#include <gfd.h>
|
||||
#include <gx2/draw.h>
|
||||
|
|
@ -56,7 +57,6 @@ static int WIIU_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *forma
|
|||
static int WIIU_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects);
|
||||
static void WIIU_DestroyWindowFramebuffer(_THIS, SDL_Window *window);
|
||||
|
||||
#define WIIU_DATA "_SDL_WiiUData"
|
||||
#define SCREEN_WIDTH 1280
|
||||
#define SCREEN_HEIGHT 720
|
||||
|
||||
|
|
@ -68,12 +68,6 @@ static const float tex_coord_vb[] =
|
|||
0.0f, 0.0f,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SDL_Surface *surface;
|
||||
GX2Texture texture;
|
||||
} WIIU_WindowData;
|
||||
|
||||
static GX2RBuffer tex_coord_buffer = {
|
||||
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
|
||||
GX2R_RESOURCE_USAGE_CPU_READ |
|
||||
|
|
@ -177,7 +171,7 @@ static int WIIU_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *forma
|
|||
*pixels = data->surface->pixels;
|
||||
*pitch = data->surface->pitch;
|
||||
|
||||
SDL_SetWindowData(window, WIIU_DATA, data);
|
||||
SDL_SetWindowData(window, WIIU_WINDOW_DATA, data);
|
||||
|
||||
// inform SDL we're ready to accept inputs
|
||||
SDL_SetKeyboardFocus(window);
|
||||
|
|
@ -201,7 +195,7 @@ static void render_scene(WIIU_WindowData *data) {
|
|||
|
||||
static int WIIU_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
|
||||
{
|
||||
WIIU_WindowData *data = (WIIU_WindowData *) SDL_GetWindowData(window, WIIU_DATA);
|
||||
WIIU_WindowData *data = (WIIU_WindowData *) SDL_GetWindowData(window, WIIU_WINDOW_DATA);
|
||||
float* buffer;
|
||||
int int_x, int_y, int_w, int_h;
|
||||
float x, y, w, h;
|
||||
|
|
@ -257,7 +251,7 @@ static int WIIU_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rec
|
|||
|
||||
static void WIIU_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
|
||||
{
|
||||
WIIU_WindowData *data = (WIIU_WindowData*) SDL_GetWindowData(window, WIIU_DATA);
|
||||
WIIU_WindowData *data = (WIIU_WindowData*) SDL_GetWindowData(window, WIIU_WINDOW_DATA);
|
||||
SDL_FreeSurface(data->surface);
|
||||
MEMFreeToDefaultHeap(data->texture.surface.image);
|
||||
SDL_free(data);
|
||||
|
|
|
|||
37
src/video/wiiu/SDL_wiiuvideo.h
Normal file
37
src/video/wiiu/SDL_wiiuvideo.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 2018-2018 Ash Logan <ash@heyquark.com>
|
||||
Copyright (C) 2018-2018 Roberto Van Eeden <r.r.qwertyuiop.r.r@gmail.com>
|
||||
|
||||
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"
|
||||
|
||||
#ifndef SDL_wiiuvideo_h
|
||||
#define SDL_wiiuvideo_h
|
||||
|
||||
#include <gx2/texture.h>
|
||||
|
||||
#define WIIU_WINDOW_DATA "_SDL_WiiUData"
|
||||
typedef struct
|
||||
{
|
||||
SDL_Surface *surface;
|
||||
GX2Texture texture;
|
||||
} WIIU_WindowData;
|
||||
|
||||
#endif //SDL_wiiuvideo_h
|
||||
Loading…
Reference in New Issue
Block a user