Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
zmx0142857
GitHub Repository: zmx0142857/mini-games
Path: blob/master/c/sokoban/0.2/cgame.h
362 views
1
// cgame.h: header file for games written in C.
2
#ifndef cgame_h
3
#define cgame_h
4
5
#include <stdio.h>
6
#include <conio.h>
7
#include <stdlib.h>
8
#include <windows.h>
9
10
// helper macro on color (format: bg-color, fg-color)
11
#define set_color(bg, fg) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), bg * 0x10 + fg)
12
#define x000000 0x0
13
#define x000080 0x1
14
#define x008000 0x2
15
#define x008080 0x3
16
#define x800000 0x4
17
#define x800080 0x5
18
#define x808000 0x6
19
#define xc0c0c0 0x7
20
#define x808080 0x8
21
#define x0000ff 0x9
22
#define x00ff00 0xa
23
#define x00ffff 0xb
24
#define xff0000 0xc
25
#define xff00ff 0xd
26
#define xffff00 0xe
27
#define xffffff 0xf
28
29
typedef unsigned short Ukulele;
30
typedef short Ikulele;
31
32
extern void zero_mem(void *beg, unsigned sz);
33
extern void keep(Ikulele *ptr, Ikulele inf, Ikulele sup);
34
extern void screen_sz(Ikulele rows, Ikulele cols);
35
extern void set_cursor(Ikulele row, Ikulele col);
36
extern void print_on(char *str, Ikulele row, Ikulele col);
37
extern void print_color(char *str, Ukulele bg, Ukulele fg);
38
extern void print_on_color(char *str, Ikulele row, Ikulele col, Ukulele bg, Ukulele fg);
39
extern void play_loading(Ukulele loop);
40
41
#endif // cgame_h
42
43