sokol test
This commit is contained in:
parent
405d255e19
commit
20939a1bab
|
@ -224,6 +224,46 @@ if(NOT EMSCRIPTEN)
|
||||||
target_link_libraries(sdl-renderer tic80core SDL2-static SDL2main)
|
target_link_libraries(sdl-renderer tic80core SDL2-static SDL2main)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
################################
|
||||||
|
# Sokol renderer example
|
||||||
|
################################
|
||||||
|
|
||||||
|
set(SOKOL_DIR sokol)
|
||||||
|
|
||||||
|
set(SOKOL_SRC
|
||||||
|
${SOKOL_DIR}/main.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
set(SOKOL_SRC ${SOKOL_SRC} ${SOKOL_DIR}/sokol.m)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_executable(sokol ${SOKOL_SRC})
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
set_property (TARGET sokol APPEND_STRING PROPERTY
|
||||||
|
COMPILE_FLAGS "-fobjc-arc")
|
||||||
|
|
||||||
|
target_link_libraries(sokol
|
||||||
|
"-framework Cocoa"
|
||||||
|
"-framework QuartzCore"
|
||||||
|
"-framework Metal"
|
||||||
|
"-framework MetalKit"
|
||||||
|
"-framework AudioToolbox"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_include_directories(sokol PRIVATE include)
|
||||||
|
target_include_directories(sokol PRIVATE ../sokol)
|
||||||
|
target_include_directories(sokol PRIVATE src)
|
||||||
|
|
||||||
|
if(MINGW)
|
||||||
|
target_link_libraries(sokol mingw32)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_dependencies(sokol tic80core)
|
||||||
|
target_link_libraries(sokol tic80core)
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# SDL GPU
|
# SDL GPU
|
||||||
################################
|
################################
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
#include "sokol_app.h"
|
||||||
|
#include "sokol_gfx.h"
|
||||||
|
#include "sokol_time.h"
|
||||||
|
#include "sokol_audio.h"
|
||||||
|
|
||||||
|
static void app_init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void app_frame(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void app_input(const sapp_event* event)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void app_cleanup(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sapp_desc sokol_main(int argc, char* argv[]) {
|
||||||
|
// args_init(argc, argv);
|
||||||
|
return (sapp_desc) {
|
||||||
|
.init_cb = app_init,
|
||||||
|
.frame_cb = app_frame,
|
||||||
|
.event_cb = app_input,
|
||||||
|
.cleanup_cb = app_cleanup,
|
||||||
|
.width = 3 * 256,
|
||||||
|
.height = 3 * 144,
|
||||||
|
.window_title = "TIC-80",
|
||||||
|
.ios_keyboard_resizes_canvas = true
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
#define SOKOL_IMPL
|
||||||
|
#define SOKOL_METAL
|
||||||
|
|
||||||
|
#include "sokol_app.h"
|
||||||
|
#include "sokol_gfx.h"
|
||||||
|
#include "sokol_time.h"
|
||||||
|
#include "sokol_audio.h"
|
Loading…
Reference in New Issue