mirror of https://github.com/mgba-emu/mgba.git
Properly support 16-bit color
This commit is contained in:
parent
02aec4fc65
commit
ad38ae63ec
|
@ -30,6 +30,13 @@ else()
|
||||||
source_group("POSIX-specific code" FILES ${OS_SRC})
|
source_group("POSIX-specific code" FILES ${OS_SRC})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_BBB OR BUILD_RASPI)
|
||||||
|
enable_language(ASM)
|
||||||
|
if(NOT BUILD_EGL)
|
||||||
|
add_definitions(-DCOLOR_16_BIT -DCOLOR_5_6_5)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
set(DEBUGGER_SRC "${CMAKE_SOURCE_DIR}/src/debugger/debugger.c;${CMAKE_SOURCE_DIR}/src/debugger/memory-debugger.c")
|
set(DEBUGGER_SRC "${CMAKE_SOURCE_DIR}/src/debugger/debugger.c;${CMAKE_SOURCE_DIR}/src/debugger/memory-debugger.c")
|
||||||
|
|
||||||
if(USE_CLI_DEBUGGER)
|
if(USE_CLI_DEBUGGER)
|
||||||
|
|
|
@ -24,8 +24,6 @@ if(BUILD_RASPI AND BUILD_EGL)
|
||||||
set(OPENGL_INCLUDE_DIR "")
|
set(OPENGL_INCLUDE_DIR "")
|
||||||
add_definitions(-DBUILD_RASPI)
|
add_definitions(-DBUILD_RASPI)
|
||||||
elseif(BUILD_BBB OR BUILD_RASPI)
|
elseif(BUILD_BBB OR BUILD_RASPI)
|
||||||
enable_language(ASM)
|
|
||||||
add_definitions(-DCOLOR_16_BIT -DCOLOR_5_6_5)
|
|
||||||
set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/sw-main.c)
|
set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/sw-main.c)
|
||||||
else()
|
else()
|
||||||
set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/gl-main.c)
|
set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/gl-main.c)
|
||||||
|
|
|
@ -113,10 +113,21 @@ static int _GBASDLInit(struct GLSoftwareRenderer* renderer) {
|
||||||
#else
|
#else
|
||||||
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
|
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef COLOR_16_BIT
|
||||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
#else
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
||||||
|
#ifdef COLOR_5_6_5
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
|
||||||
|
#else
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
|
||||||
|
#endif
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
renderer->window = SDL_CreateWindow("GBAc", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, renderer->viewportWidth, renderer->viewportHeight, SDL_WINDOW_OPENGL);
|
renderer->window = SDL_CreateWindow("GBAc", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, renderer->viewportWidth, renderer->viewportHeight, SDL_WINDOW_OPENGL);
|
||||||
SDL_GL_CreateContext(renderer->window);
|
SDL_GL_CreateContext(renderer->window);
|
||||||
|
|
Loading…
Reference in New Issue