Skip to content

Commit

Permalink
Implement part 5 of the tutorial. Add 0.5 to the view radius for nice…
Browse files Browse the repository at this point in the history
…r circle.
  • Loading branch information
MrSmith33 committed Dec 8, 2019
1 parent 15a2135 commit 61197f9
Show file tree
Hide file tree
Showing 7 changed files with 351 additions and 225 deletions.
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
tjc source/main.vx source/kernel32.vx source/sdl.vx source/sdlimage.vx source/utils.vx bin/SDL2.dll bin/SDL2_image.dll C:\Windows\System32\kernel32.dll --of=bin/main.exe
tjc source/main.vx source/kernel32.vx source/sdl.vx source/sdlimage.vx source/tile.vx source/entity.vx source/window.vx source/utils.vx bin/SDL2.dll bin/SDL2_image.dll C:\Windows\System32\kernel32.dll --of=bin/main.exe --print-time --print-mem
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

[Vox compiler](https://github.com/MrSmith33/tiny_jit)

[Latest release](/releases/latest)

Compile with `tjc source/main.vx source/kernel32.vx source/sdl.vx source/sdlimage.vx source/utils.vx SDL2.dll SDL2_image.dll C:\Windows\System32\kernel32.dll`
produces `main.exe` for win64

Expand Down
37 changes: 37 additions & 0 deletions source/entity.vx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import utils;

enum EntityFlags : u8 {
blocks = 1 << 0,
}

struct Entity
{
i32 x;
i32 y;
u8 flags;
u8 char;
u8 r;
u8 g;
u8 b;
u8[] name;

void move(i32 dx, i32 dy) {
print("Move ");
printInt(x);
print(" ");
printInt(y);
x += dx;
y += dy;
print(" -> ");
printInt(x);
print(" ");
printInt(y);
print(" ");
print(name);
println(null);
}

bool blocks() { return flags & EntityFlags.blocks; }
}

alias EntityId = u16;
Loading

0 comments on commit 61197f9

Please sign in to comment.