Compare commits

...

2 Commits

Author SHA1 Message Date
f99024bb75 add testing
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-29 19:35:57 +02:00
b7a53bdb43 fix stuff
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-29 11:22:38 +02:00
4 changed files with 66 additions and 9 deletions

@ -7,12 +7,16 @@ steps:
image: alpine
#install make and gcc
commands:
- apk add build-base ncurses-dev ncurses ncurses-terminfo ncurses-static
- apk add build-base ncurses-dev ncurses ncurses-terminfo ncurses-static g++
- mkdir build
- gcc -static -o build/main main.c -l:libncurses.so
- gcc -static -o build/main_static_alpine main.c -l:libncurses.so
- gcc -o build/main_dynamic main.c -lncurses
artifacts:
- name: compiled
path: main
- name: compiled_static
path: build/main_static_alpine
type: file
- name: compiled_dynamic
path: build/main_dynamic
type: file
- name: gitea_release
image: plugins/gitea-release

BIN
main

Binary file not shown.

35
main.c

@ -12,10 +12,12 @@
#include <math.h>
#include <string.h>
uint16_t Hole_Div = 40;
uint16_t SCR_X;
uint16_t SCR_Y;
#define FPS (60)
uint16_t FPS = 60;
char blank_char = 32;
char wall_char = 35;
char goal_char = 71;
@ -26,6 +28,7 @@ uint16_t wall_color = 1;
uint16_t goal_color = 2;
uint16_t player_color = 3;
uint16_t border_color = 4;
uint16_t Quit_on_pass = 0;
char letter = ' ';
struct Object {
uint16_t x;
@ -236,9 +239,26 @@ int main(int argc, char * argv[]) {
SCR_Y = atoi(argv[2]);
Hole_Div = atoi(argv[3]);
}
if(argc == 5){
SCR_X = atoi(argv[1]);
SCR_Y = atoi(argv[2]);
Hole_Div = atoi(argv[3]);
FPS = atoi(argv[4]);
}
if (argc == 6){
SCR_X = atoi(argv[1]);
SCR_Y = atoi(argv[2]);
Hole_Div = atoi(argv[3]);
FPS = atoi(argv[4]);
if(strcmp(argv[5],"-n") == 0){
Quit_on_pass = 1;
}
}
generate_maze();
render_maze();
draw_maze();
if(Quit_on_pass == 0){
render_maze();
draw_maze();
}
while (1) {
inputs_tmp = keyinput();
if (inputs_tmp == 1) {
@ -250,10 +270,15 @@ int main(int argc, char * argv[]) {
} else {
orient = 0;
}
if(Quit_on_pass == 1){
return 4;
}
generate_maze();
}
render_maze();
draw_maze();
if(Quit_on_pass == 0){
render_maze();
draw_maze();
}
usleep(round(1000000 / FPS));
}
endwin();

28
test.sh Normal file

@ -0,0 +1,28 @@
#!/bin/bash
RANDOM=$$$(date +%s)
X=""
CNT=0
CNTX=0
CNTA=0
CNTB=0
CNTXB=0
CNTAB=0
while [ $CNTX -lt 50 ]; do
let CNT=0
while [ $CNT -lt 162 ]; do
X+="wd"
let CNT=CNT+1
done
let CNTA=0
while [ $CNTA -lt 162 ]; do
X+="wa"
let CNTA=CNTA+1
done
let CNTX=CNTX+1
done
X+="q"
echo $X