Split SDL2 code from Draw.cpp

This commit is contained in:
Clownacy 2020-03-31 16:11:31 +01:00
parent 3a5a5044b1
commit 142bca6578
5 changed files with 30 additions and 9 deletions

View file

@ -518,6 +518,13 @@ static void GlyphBatch_DestroyTexture(SPRITEBATCH_U64 texture_id, void *udata)
Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
{
puts("Available SDL2 video drivers:");
for (int i = 0; i < SDL_GetNumVideoDrivers(); ++i)
puts(SDL_GetVideoDriver(i));
printf("Selected SDL2 video driver: %s\n", SDL_GetCurrentVideoDriver());
#ifdef USE_OPENGLES2
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0);

View file

@ -1,6 +1,7 @@
#include "../Rendering.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include "SDL.h"
@ -43,6 +44,13 @@ static void RectToSDLRect(const RECT *rect, SDL_Rect *sdl_rect)
Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
{
puts("Available SDL2 video drivers:");
for (int i = 0; i < SDL_GetNumVideoDrivers(); ++i)
puts(SDL_GetVideoDriver(i));
printf("Selected SDL2 video driver: %s\n", SDL_GetCurrentVideoDriver());
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, 0);
if (window != NULL)

View file

@ -116,6 +116,13 @@ static void GlyphBatch_DestroyTexture(SPRITEBATCH_U64 texture_id, void *udata)
Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
{
puts("Available SDL2 video drivers:");
for (int i = 0; i < SDL_GetNumVideoDrivers(); ++i)
puts(SDL_GetVideoDriver(i));
printf("Selected SDL2 video driver: %s\n", SDL_GetCurrentVideoDriver());
puts("Available SDL2 render drivers:");
for (int i = 0; i < SDL_GetNumRenderDrivers(); ++i)

View file

@ -1,6 +1,7 @@
#include "../Rendering.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -38,6 +39,13 @@ static Backend_Surface *glyph_destination_surface;
Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
{
puts("Available SDL2 video drivers:");
for (int i = 0; i < SDL_GetNumVideoDrivers(); ++i)
puts(SDL_GetVideoDriver(i));
printf("Selected SDL2 video driver: %s\n", SDL_GetCurrentVideoDriver());
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, 0);
if (window != NULL)

View file

@ -5,8 +5,6 @@
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
#include "WindowsWrapper.h"
#include "Backends/Rendering.h"
@ -87,13 +85,6 @@ BOOL Flip_SystemTask(void)
BOOL StartDirectDraw(const char *title, int width, int height, int lMagnification)
{
puts("Available SDL2 video drivers:");
for (int i = 0; i < SDL_GetNumVideoDrivers(); ++i)
puts(SDL_GetVideoDriver(i));
printf("Selected SDL2 video driver: %s\n", SDL_GetCurrentVideoDriver());
memset(surface_metadata, 0, sizeof(surface_metadata));
switch (lMagnification)