video/wiiu: Add flags to only draw on TV or Gamepad (#1)

This commit is contained in:
Kuruyia 2019-03-03 13:19:55 +01:00 committed by Ash
parent fc596d922b
commit 93eaa4e8f4
3 changed files with 21 additions and 14 deletions

View File

@ -113,13 +113,15 @@ typedef enum
SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported.
On macOS NSHighResolutionCapable must be set true in the
application's Info.plist for this to have any effect. */
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */
SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */
SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
SDL_WINDOW_WIIU_GAMEPAD_ONLY = 0x01000000, /**< Wii U: window must be drawn only on the Gamepad */
SDL_WINDOW_WIIU_TV_ONLY = 0x02000000, /**< Wii U: window must be drawn only on the TV */
SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */
} SDL_WindowFlags;
/**

View File

@ -1351,7 +1351,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
}
#define CREATE_FLAGS \
(SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED)
(SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_WIIU_GAMEPAD_ONLY | SDL_WINDOW_WIIU_TV_ONLY)
static SDL_INLINE SDL_bool
IsAcceptingDragAndDrop(void)

View File

@ -200,6 +200,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_WINDOW_DATA);
Uint32 flags = SDL_GetWindowFlags(window);
float a_position[8];
float* buffer;
int x, y, w, h;
@ -221,13 +222,17 @@ static int WIIU_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rec
WHBGfxBeginRender();
WHBGfxBeginRenderTV();
render_scene(data);
WHBGfxFinishRenderTV();
if (!(flags & SDL_WINDOW_WIIU_GAMEPAD_ONLY)) {
WHBGfxBeginRenderTV();
render_scene(data);
WHBGfxFinishRenderTV();
}
WHBGfxBeginRenderDRC();
render_scene(data);
WHBGfxFinishRenderDRC();
if (!(flags & SDL_WINDOW_WIIU_TV_ONLY)) {
WHBGfxBeginRenderDRC();
render_scene(data);
WHBGfxFinishRenderDRC();
}
WHBGfxFinishRender();