mirror of
https://github.com/vanilla-wiiu/vanilla.git
synced 2026-10-28 09:43:51 +00:00
started rpi app
This commit is contained in:
1 parent
ef1a06af27
commit
b2eaac33fd
3 files changed
+62
-1
No files matched your search
+9
-1
@@ -9,6 +9,14 @@ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
|
||||
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
OPTION(VANILLA_BUILD_DESKTOP "Build Qt app for Linux desktop" ON)
|
||||
OPTION(VANILLA_BUILD_RPI "Build SDL2 app for Raspberry Pi" OFF)
|
||||
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(pipe)
|
||||
add_subdirectory(app)
|
||||
if (VANILLA_BUILD_QT)
|
||||
add_subdirectory(app)
|
||||
endif()
|
||||
if (VANILLA_BUILD_RPI)
|
||||
add_subdirectory(rpi)
|
||||
endif()
|
||||
@@ -0,0 +1,14 @@
|
||||
find_package(SDL2 REQUIRED)
|
||||
|
||||
add_executable(vanilla-pi
|
||||
main.c
|
||||
)
|
||||
|
||||
target_include_directories(vanilla-pi PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/lib"
|
||||
)
|
||||
|
||||
target_link_libraries(vanilla-pi PRIVATE
|
||||
SDL2::SDL2
|
||||
vanilla
|
||||
)
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#define SCREEN_WIDTH 854
|
||||
#define SCREEN_HEIGHT 480
|
||||
|
||||
#include <stdio.h>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <vanilla.h>
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
SDL_Window* window = NULL;
|
||||
SDL_Surface* screenSurface = NULL;
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_GAMECONTROLLER) < 0) {
|
||||
fprintf(stderr, "Failed to initialize SDL: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
window = SDL_CreateWindow(
|
||||
"Vanilla Pi",
|
||||
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
||||
SCREEN_WIDTH, SCREEN_HEIGHT,
|
||||
SDL_WINDOW_SHOWN
|
||||
);
|
||||
if (window == NULL) {
|
||||
fprintf(stderr, "could not create window: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
screenSurface = SDL_GetWindowSurface(window);
|
||||
SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xFF, 0x00, 0xFF));
|
||||
SDL_UpdateWindowSurface(window);
|
||||
|
||||
vanilla_start();
|
||||
|
||||
SDL_Delay(10000);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user