Skip to content

Commit

Permalink
comment build.sh and move examples to examples/nelua
Browse files Browse the repository at this point in the history
This way examples of other languages have a good place to stay.
  • Loading branch information
Andre-LA committed Mar 24, 2023
1 parent e3fd32a commit a536676
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 7 deletions.
8 changes: 8 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,24 @@ then
LUA=$3
fi

# echo configuration
echo "config:"
echo "C compiler: $CC"
echo "Object achiver: $AR"
echo "Lua interpreter: $LUA"

# setup flags

## warning flags
WFLAGS="-Wall -Wextra -Wpedantic"

# C standard flag
CSTD="-std=c99"

# include flags
IFLAGS="-I./include/"

# source files
SOURCES="src/*.c src/math/*.c src/audio/*.c"

# clear previous build
Expand Down
7 changes: 7 additions & 0 deletions examples/nelua/.neluacfg.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
return {
add_path = {
"../../bindings/nelua/"
},
cflags = "-I../../include",
ldflags = "-L../../build",
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/pong.nelua → examples/nelua/pong.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ local function game()
}

-- "monogram_extended" font is available with nene, but it's not loaded automatically.
local ok, font <close> = Font.load('resources/monogram_extended.ttf', 72)
local ok, font <close> = Font.load('../../resources/monogram_extended.ttf', 72)
assert(ok, 'could not load monogram_extended font')

-- creates both players texts and then defer it's destroy calls
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ local function audio_and_music()
defer Nene.terminate() end

-- sound and music loading and deferred destroyment
local ok, click <close> = Sound.load('resources/pixelclick.wav')
local ok, click <close> = Sound.load('../../resources/pixelclick.wav')
assert(ok , 'could not load pixelclick sound')

local ok, bossa <close> = Music.load('resources/8bit Bossa.ogg')
local ok, bossa <close> = Music.load('../../resources/8bit Bossa.ogg')
assert(ok, 'could not load 8bit Bossa music')

local mus_volume, click_volume = 1.0, 1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ local function game()
More details can be read on the texture_atlas example.
]]
local ok, spritesheet <close> = TextureAtlas.load('resources/img_shapes.png', 2, { cell_size = {32, 32} })
local ok, spritesheet <close> = TextureAtlas.load('../../resources/img_shapes.png', 2, { cell_size = {32, 32} })
assert(ok, "error: 'img_shapes.png' could not be loaded")


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local function texture_atlas_example()
assert(ok, "nene couldn't be initialized")

--[[
First, let's load the "img_shapes" image from "resources", this image contains
First, let's load the "img_shapes" image from "../../resources", this image contains
four shapes with two shapes per-line, aligned on a 32x32 grid:
circle, square,
Expand All @@ -30,7 +30,7 @@ local function texture_atlas_example()
cell_size of grid should be set to { 32, 32}, there's no gap between cells, thus the
`gap` field isn't set.
]]
local ok, atlas <close> = TextureAtlas.load('resources/img_shapes.png', 2, { cell_size = {32, 32 }})
local ok, atlas <close> = TextureAtlas.load('../../resources/img_shapes.png', 2, { cell_size = {32, 32 }})
assert(ok, "TextureAtlas texture couldn't be loaded")

-- game loop
Expand Down
2 changes: 1 addition & 1 deletion examples/tilemaps.nelua → examples/nelua/tilemaps.nelua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ local function game()
assert(ok, 'error: nene initialization failed')

-- load the tileset texture atlas, more details on `tilesets` example
local ok, tileset <close> = TextureAtlas.load('resources/img_shapes.png', 2, { cell_size = {32, 32} })
local ok, tileset <close> = TextureAtlas.load('../../resources/img_shapes.png', 2, { cell_size = {32, 32} })
assert(ok, "error: 'img_shapes.png' could not be loaded")

-- set the tilemap
Expand Down

0 comments on commit a536676

Please sign in to comment.