Skip to content

Instantly share code, notes, and snippets.

@daveloyall
Created September 1, 2017 19:06
Show Gist options
  • Save daveloyall/f107751296dcfabb2a06136f0b806911 to your computer and use it in GitHub Desktop.
Save daveloyall/f107751296dcfabb2a06136f0b806911 to your computer and use it in GitHub Desktop.
C help?
wut: wut.c
$(CC) -g wut.c -o wut -Wall -Wextra -pedantic -std=c99
#include <stdio.h>
#define BOARD_HEIGHT 16
#define SCREEN_HEIGHT 32
#define VERTICAL_RATIO SCREEN_HEIGHT / BOARD_HEIGHT
int main() {
unsigned int y = 26;
unsigned int board_y = y / VERTICAL_RATIO;
printf("%d\n",board_y);
}
@daveloyall
Copy link
Author

hobbes@metalbaby:~/src-e2/graphspace$ ./grid 
 0 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 2 **                            ##
 3 **                            ##
 4 **                            ##
 5 **                            ##
 6 **                            ##
 7 **                            ##
 8 **                            ##
 9 **                            ##
10 **                            ##
11 **                            ##
12 **                            ##
13 **                            ##
14 **                            ##
15 **                            ##
16 **                            ##
17 **                            ##
18 **                            ##
19 **                            ##
20 **                            ##
21 **                            ##
22 **                            ##
23 **                            ##
24 **                            ##
25 **                            ##
26 **                            ##
27 **                            ##
28 **                            ##
29 **                            ##
30 ================================
31 ================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment