Add Lua scripting support to desktop emulator
- Created emulator-specific lua_game_emulator.cpp using filesystem instead of FatFS - Created lua_game_loader_emulator.cpp to scan games/lua_examples directory - Updated CMakeLists.txt to include Lua 5.4 engine and bindings - Updated to SFML 3.0 API compatibility (event handling, sprite initialization) - Updated Game class to use public members for Lua bindings - Updated GameLauncher to use std::function for lambda captures - Added continuous 60 FPS rendering for smooth display - Emulator now loads and runs all three example Lua games
This commit is contained in:
@@ -3,17 +3,41 @@ project(basic1_emulator)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
find_package(SFML 2.5 COMPONENTS graphics window system REQUIRED)
|
||||
find_package(SFML 3.0 COMPONENTS Graphics Window System REQUIRED)
|
||||
|
||||
# Lua source files
|
||||
file(GLOB LUA_SOURCES "../lib/lua/*.c")
|
||||
list(FILTER LUA_SOURCES EXCLUDE REGEX "lua\\.c$|luac\\.c$|loslib\\.c$|liolib\\.c$")
|
||||
|
||||
# Game source files
|
||||
set(GAME_SOURCES
|
||||
../games/lua_bindings.cpp
|
||||
../games/demo_game.cpp
|
||||
../games/tic_tac_toe.cpp
|
||||
../games/monopoly/monopoly_game.cpp
|
||||
../games/monopoly/player.c
|
||||
../lib/game_launcher.cpp
|
||||
../display/low_level_render.cpp
|
||||
../display/low_level_gui.cpp
|
||||
)
|
||||
|
||||
# Add source files
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
low_level_display_sfml.cpp
|
||||
lua_game_emulator.cpp
|
||||
lua_game_loader_emulator.cpp
|
||||
input_manager.cpp
|
||||
${GAME_SOURCES}
|
||||
${LUA_SOURCES}
|
||||
# Add more emulator-specific sources here
|
||||
)
|
||||
|
||||
add_executable(basic1_emulator ${SOURCES})
|
||||
|
||||
target_include_directories(basic1_emulator PRIVATE ../display ../fonts ../games .)
|
||||
# Define LUA_32BITS for 32-bit embedded mode
|
||||
target_compile_definitions(basic1_emulator PRIVATE LUA_32BITS=1)
|
||||
|
||||
target_link_libraries(basic1_emulator sfml-graphics sfml-window sfml-system)
|
||||
target_include_directories(basic1_emulator PRIVATE . .. ../display ../fonts ../games ../lib ../lib/lua)
|
||||
|
||||
target_link_libraries(basic1_emulator SFML::Graphics SFML::Window SFML::System)
|
||||
|
||||
Reference in New Issue
Block a user