From 6e4fdd3b3ae4e4656e151f098c40cfe551a36e8c Mon Sep 17 00:00:00 2001 From: jussi Date: Fri, 18 Feb 2022 18:27:10 +0200 Subject: Added initial files. --- src/main.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/main.c (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..e9d5db2 --- /dev/null +++ b/src/main.c @@ -0,0 +1,37 @@ +#include "main.h" +#include "state.h" +#include "lua_core.h" + +int main( int argn, const char **argc ) { + char exePath[ STRING_LEN ] = { '\0' }; + + if ( 1 < argn ) { + if ( strcmp( argc[1], "--version" ) == 0 || strcmp( argc[1], "-v" ) == 0 ) { + printf( "ReiLua %d.%d\n", VERSION_MAJOR, VERSION_MINOR ); + + return 1; + } + else{ + sprintf( exePath, "%s/%s", GetWorkingDirectory(), argc[1] ); + } + } + else { + sprintf( exePath, "%s/", GetWorkingDirectory() ); + } + + stateInit( exePath ); + + while ( state->run ) { + if ( WindowShouldClose() ) { + state->run = false; + } + if ( IsAudioDeviceReady() ) { + UpdateMusicStream( state->music ); + } + luaCallProcess(); + luaCallDraw(); + } + stateFree(); + + return 1; +} -- cgit v1.2.3