3 Commits
1.0.0 ... 1.0.1

Author SHA1 Message Date
7700d4fdb0 fix stic compile
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-29 11:10:12 +02:00
1ebdd68873 compile statically
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-29 10:58:43 +02:00
ab4ddaf365 clean up bullets
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-29 10:43:50 +02:00
4 changed files with 5 additions and 17 deletions

View File

@@ -7,9 +7,9 @@ steps:
image: alpine
#install make and gcc
commands:
- apk add build-base ncurses-dev
- apk add build-base ncurses-dev ncurses ncurses-terminfo ncurses-static
- mkdir build
- gcc -o build/main main.c -lncurses
- gcc -static -o build/main main.c -l:libncurses.so
artifacts:
- name: compiled
path: main

4
.vscode/tasks.json vendored
View File

@@ -13,13 +13,15 @@
],
"command": "/usr/bin/gcc",
"args": [
"-static",
"-fdiagnostics-color=always",
"-g",
"${workspaceFolder}/main.c",
"-o",
//include ncurses
"${fileDirname}/${fileBasenameNoExtension}",
"-lncurses"
"-lncurses",
"-ltinfo"
],
"options": {
"cwd": "${fileDirname}"

BIN
main

Binary file not shown.

14
main.c
View File

@@ -20,15 +20,12 @@ char blank_char = 32;
char wall_char = 35;
char goal_char = 71;
char player_char = 80;
char bullet_char = 120;
char inchar = ' ';
uint16_t blank_color = 0;
uint16_t wall_color = 1;
uint16_t goal_color = 2;
uint16_t player_color = 3;
uint16_t border_color = 4;
uint16_t bullet1_color = 5;
uint16_t bullet2_color = 5;
char letter = ' ';
struct Object {
uint16_t x;
@@ -37,13 +34,6 @@ struct Object {
uint16_t color;
uint8_t dir;
};
struct Bullet {
uint16_t x;
uint16_t y;
uint8_t dir;
uint8_t color;
};
uint16_t bulletptr = 0;
uint16_t player_x = 0;
uint16_t player_y = 0;
uint16_t goal_x = 0;
@@ -52,7 +42,6 @@ uint16_t rng_tmp = 0;
uint16_t orient = 0;
uint16_t inputs_tmp = 0;
struct Object * rendered;
struct Bullet * bullets;
char * playfield;
int randomInt(int lower, int upper) {
return rand() % (upper - lower + 1) + lower;
@@ -163,7 +152,6 @@ void init() {
getmaxyx(stdscr, SCR_Y, SCR_X);
playfield = malloc(sizeof(char) * SCR_Y * SCR_X);
rendered = malloc(sizeof(struct Object) * (SCR_X) * (SCR_Y));
bullets = malloc(sizeof(struct Bullet) * (SCR_X) * (SCR_Y));
noecho();
nodelay(stdscr, TRUE);
start_color();
@@ -172,8 +160,6 @@ void init() {
init_pair(goal_color, COLOR_BLACK, COLOR_GREEN);
init_pair(player_color, COLOR_BLACK, COLOR_YELLOW);
init_pair(border_color, COLOR_WHITE, COLOR_BLUE);
init_pair(bullet1_color, COLOR_BLACK, COLOR_YELLOW);
init_pair(bullet2_color, COLOR_BLACK, COLOR_GREEN);
attron(COLOR_PAIR(blank_color));
clear();
srand(time(NULL));