Skip to content

Commit

Permalink
feat: added coin game to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjercan committed Apr 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 1dfb7d0 commit 3add014
Showing 6 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- @alexjercan Random module `random`
- @alexjercan Threading module `threading`
- @alexjercan Netowrking module `net`
- @alexjercan Multiplayer Game: Coin Chase 2D

### Changed

6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -39,10 +39,8 @@ examples: all
./coolc examples/snake.cl --module raylib --module random -o build/snake
./coolc examples/sockets.cl --module prelude -o build/sockets
./coolc examples/threading.cl --module threading -o build/threading

game: all
./coolc examples/multi/server.cl examples/multi/message.cl --module net --module threading --module data --module random -o build/game-server
./coolc examples/multi/client.cl examples/multi/message.cl --module net --module threading --module raylib -o build/game-client
./coolc examples/coin/server.cl examples/coin/message.cl --module net --module threading --module data --module random -o build/coin-server
./coolc examples/coin/client.cl examples/coin/message.cl --module net --module threading --module raylib -o build/coin-client

dist: clean all
rm -rf coolc.tar.gz
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 7 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
@@ -12,13 +12,13 @@
#include "semantic.h"

// Add support for the following:
// - Threading class that uses Linux or pthreads IDK
// - abort for dispatch on void
// - abort for case on void
// - abort for case on no match
// - exception handling
// - numeric base class for Int, Float and Byte to be able to use arithmetic

const char *prelude = "prelude";
#define FASM "fasm"
#define LD "ld"
#define DEFAULT_OUTPUT "main"
@@ -69,6 +69,9 @@ static int build_context_prelude_init(build_context *context) {
}

ds_argparse_get_values(&context->parser, ARG_MODULE, &modules);
if (modules.count == 0) {
ds_dynamic_array_append(&modules, &prelude);
}

if (util_append_path(cool_lib, "depends.txt", &depends_path) != 0) {
DS_LOG_ERROR("Failed to append path");
@@ -452,6 +455,9 @@ static enum status_code ld_run(build_context *context) {
ds_dynamic_array_init(&modules, sizeof(const char *));

ds_argparse_get_values(&context->parser, ARG_MODULE, &modules);
if (modules.count == 0) {
ds_dynamic_array_append(&modules, &prelude);
}

char *output = ds_argparse_get_value(&context->parser, ARG_OUTPUT);
char *obj_path = NULL;

0 comments on commit 3add014

Please sign in to comment.