summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--README.md2
-rw-r--r--devnotes2
-rw-r--r--examples/2D_camera/main.lua2
-rw-r--r--examples/image_draw/main.lua2
-rw-r--r--examples/platformer/main.lua5
-rw-r--r--src/core.c2
-rw-r--r--src/models.c8
-rw-r--r--src/textures.c2
9 files changed, 21 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 09a73ab..a765a77 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,7 +23,7 @@ if( EMSCRIPTEN ) # Web
target_link_libraries( ${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/lib/web/liblua.a )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY" )
- set( CMAKE_EXECUTABLE_SUFFIX ".html" ) # This line is used to set your executable to build with the emscripten html template so taht you can directly open it.
+ set( CMAKE_EXECUTABLE_SUFFIX ".html" ) # This line is used to set your executable to build with the emscripten html template so that you can directly open it.
set( resources_dir "resources" )
set_target_properties( ${PROJECT_NAME} PROPERTIES LINK_FLAGS "--preload-file ${resources_dir}" )
else() # Desktop
@@ -54,6 +54,7 @@ else() # Desktop
target_link_libraries( ${PROJECT_NAME} "-framework Cocoa" )
target_link_libraries( ${PROJECT_NAME} "-framework OpenGL" )
elseif( WIN32 )
+ set( CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-mwindows" )
target_link_libraries( ${PROJECT_NAME} mingw32 opengl32 gdi32 winmm )
endif()
endif()
diff --git a/README.md b/README.md
index dea78db..2e949ad 100644
--- a/README.md
+++ b/README.md
@@ -215,7 +215,7 @@ ReiLua
||\main.lua
```
-We can now build the game. You can use the command it top of the "CMakeLists.txt" to use emsdk toolchain with cmake. Remember to replace \<YOUR PATH HERE> with correct path.
+We can now build the game. You can use the command in the top of the "CMakeLists.txt" to use emsdk toolchain with cmake. Remember to replace \<YOUR PATH HERE> with correct path.
```
cmake .. -DCMAKE_TOOLCHAIN_FILE=<YOUR PATH HERE>/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DPLATFORM=Web
diff --git a/devnotes b/devnotes
index 9ed6bd2..b531001 100644
--- a/devnotes
+++ b/devnotes
@@ -2,6 +2,8 @@ Current {
}
Backlog {
+ * Audio
+ * Pan (From newer RayLib).
* Text
* Codepoints
* String management. At least TextSplit.
diff --git a/examples/2D_camera/main.lua b/examples/2D_camera/main.lua
index 54d3ec6..55c3b5a 100644
--- a/examples/2D_camera/main.lua
+++ b/examples/2D_camera/main.lua
@@ -36,7 +36,7 @@ function process( delta )
cameraPos[2] = cameraPos[2] - cameraSpeed * delta
end
-- Rotate.
- if RL_IsKeyDown( string.byte( "E" ) ) then
+ if RL_IsKeyDown( string.byte( "E" ) ) then -- Or RL_IsKeyDown( KEY_E )
cameraRot = cameraRot + cameraRotSpeed * delta
elseif RL_IsKeyDown( string.byte( "Q" ) ) then
cameraRot = cameraRot - cameraRotSpeed * delta
diff --git a/examples/image_draw/main.lua b/examples/image_draw/main.lua
index 7d5cb90..2da0c58 100644
--- a/examples/image_draw/main.lua
+++ b/examples/image_draw/main.lua
@@ -34,7 +34,7 @@ function init()
textImage = RL_ImageText( 0, "Cat", 10, 4, WHITE )
local imageSize = RL_GetImageSize( textImage )
RL_ImageDraw( image, textImage, { 0, 0, imageSize[1], imageSize[2] }, { 250, 40, imageSize[1], imageSize[2] }, WHITE )
-
+
texture = RL_LoadTextureFromImage( image )
end
diff --git a/examples/platformer/main.lua b/examples/platformer/main.lua
index 5bfa6ab..0032d0d 100644
--- a/examples/platformer/main.lua
+++ b/examples/platformer/main.lua
@@ -49,6 +49,11 @@ local player = {
facing = 1,
}
+local kissa = { Vec2:new( 2, 4 ), 23 }
+
+-- print( table.concat( kissa ) )
+print( kissa[1] )
+
local function createMap()
for x = 1, tilemap.size.x do
table.insert( tilemap.tiles, {} )
diff --git a/src/core.c b/src/core.c
index 8e48c0a..d6a6c7f 100644
--- a/src/core.c
+++ b/src/core.c
@@ -331,7 +331,7 @@ int lcoreSetWindowState( lua_State *L ) {
}
/*
-> state = RL_IsWindowState( int flag ) )
+> state = RL_IsWindowState( int flag )
Check if one specific window flag is enabled ( FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE... )
diff --git a/src/models.c b/src/models.c
index ef5e493..fc294e0 100644
--- a/src/models.c
+++ b/src/models.c
@@ -1554,7 +1554,13 @@ int lmodelsCreateMaterial( lua_State *L ) {
while ( lua_next( L, t4 ) != 0 ) {
if ( strcmp( "texture", (char*)lua_tostring( L, -2 ) ) == 0 && lua_isnumber( L, -1 ) ) {
- state->materials[i]->maps[map].texture = *state->textures[ lua_tointeger( L, -1 ) ];
+ size_t texId = lua_tointeger( L, -1 );
+
+ if ( !validSourceTexture( texId ) ) {
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ state->materials[i]->maps[map].texture = *texturesGetSourceTexture( texId );
}
else if ( strcmp( "color", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
state->materials[i]->maps[map].color = uluaGetColor( L );
diff --git a/src/textures.c b/src/textures.c
index fe0848b..7cc423a 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -1285,7 +1285,7 @@ Get image pixel color at ( x, y ) position
- Success return Color
*/
int ltexturesGetImageColor( lua_State *L ) {
- if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
+ if ( !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetImageColor( Image image, Vector2 pixelPos )" );
lua_pushboolean( L, false );
return 1;