+9
run.sh
+9
run.sh
+5
scripts/_config.sh
+5
scripts/_config.sh
+12
scripts/build-prod.sh
+12
scripts/build-prod.sh
+5
-18
scripts/build.sh
+5
-18
scripts/build.sh
···
1
1
#!/usr/bin/env sh
2
2
set -e
3
-
. scripts/_config.sh
4
3
5
-
mkdir -p build/
6
-
7
-
if [ -e "build/keraforge" ]
8
-
then
9
-
rm build/keraforge
10
-
fi
4
+
. scripts/_config.sh
11
5
12
-
echo ": building"
13
-
for f in `find src/ -name '*.c'`
14
-
do
15
-
ff=$(echo "$f" | tr '/' '_')
16
-
gcc -Wall -Wextra -Werror -std=c99 -Iinclude/ -c $f -o build/${ff%.c}.o
17
-
done
18
-
19
-
echo ": linking"
20
-
gcc -lraylib -lm -lGL -lpthread -ldl -lrt -lX11 build/*.o -o build/keraforge
21
-
22
-
rm build/*.o
6
+
sh scripts/functions/init.sh
7
+
sh scripts/functions/compile.sh
8
+
sh scripts/functions/link.sh
9
+
sh scripts/functions/cleanup.sh
+7
scripts/clean.sh
+7
scripts/clean.sh
+5
scripts/functions/cleanup.sh
+5
scripts/functions/cleanup.sh
+10
scripts/functions/compile.sh
+10
scripts/functions/compile.sh
+9
scripts/functions/init.sh
+9
scripts/functions/init.sh
+5
scripts/functions/link.sh
+5
scripts/functions/link.sh
+10
scripts/run.sh
+10
scripts/run.sh
+7
src/main.c
+7
src/main.c
···
9
9
10
10
static Camera2D cam;
11
11
static f32 dt = 0;
12
+
static struct kf_vec2(u32) select = { 0, 0 };
12
13
13
14
static void _player_tick(struct kf_world *world, struct kf_actor *self)
14
15
{
···
114
115
{
115
116
player->tick(world, player);
116
117
118
+
Vector2 v = GetScreenToWorld2D(GetMousePosition(), cam);
119
+
select.x = v.x / KF_TILE_SIZE_PX;
120
+
select.y = v.y / KF_TILE_SIZE_PX;
121
+
117
122
BeginDrawing();
118
123
ClearBackground(WHITE);
119
124
120
125
BeginMode2D(cam);
121
126
kf_world_draw(world, cam);
127
+
if (select.x < world->width && select.y < world->height)
128
+
DrawRectangleLines(select.x * KF_TILE_SIZE_PX, select.y * KF_TILE_SIZE_PX, KF_TILE_SIZE_PX, KF_TILE_SIZE_PX, WHITE);
122
129
player->draw(world, player);
123
130
EndMode2D();
124
131