Skip to content

Commit d93f1fc

Browse files
authored
Create README.md for CShellEngine project
Add README.md with project overview and usage example
1 parent 9c8ce8f commit d93f1fc

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# CShellEngine
2+
CShellEngine is a framework library designed to help set up the boilerplate for C-based terminal games and applications.
3+
4+
## Features
5+
- 3D/2D grid system.
6+
- Rendering of grid system.
7+
- Keyboard input handling.
8+
- Random number generation.
9+
- Game loop handling.
10+
- Delta time for game loop system.
11+
- Datatypes such as: `Vector2i`, `Vector3i`, `Vector2f`, `Vector3f`.
12+
13+
## Platforms
14+
``` diff
15+
+ Linux: Tested, supported.
16+
- Windows: Untested, currently unsupported.
17+
! macOS: Untested, expected to work (may require specific terminal settings/environment).
18+
```
19+
20+
## Usage
21+
Simply include the headers you need in your C program.
22+
And make sure to include all C source files in compilation.
23+
24+
## Example
25+
``` c
26+
#include "Core.h"
27+
#include "Rendering.h"
28+
#include "Input.h"
29+
30+
void game_loop() {
31+
printf("main method.\n");
32+
Core___game_loop_quit_flag = true;
33+
}
34+
35+
void render() {
36+
Rendering___render(NULL);
37+
}
38+
39+
int main() {
40+
Vector3i grid_size_ = {3, 1, 2};
41+
Core___initCore(&grid_size_, &game_loop, NULL);
42+
Rendering___init(NULL);
43+
44+
Input___setInputMode(false, false);
45+
Rendering___setMapping(1, "Hello World!\n");
46+
47+
Core___grid[0][0][0] = 1;
48+
49+
while (!Input___isKeyPressed('a')); // wait for 'a' key
50+
51+
printf("\na pressed\n");
52+
printf("%c pressed\n", Input___getKey()); // wait for and print pressed key
53+
54+
Core___startGameLoop(&render);
55+
56+
printf("\ndelta time: %f\nrender time: %f\n", Core___delta_time, Rendering___render_time);
57+
58+
Rendering___cleanup(NULL);
59+
Core___cleanupCore(NULL);
60+
Input___setInputMode(true, true);
61+
62+
return 0;
63+
}
64+
```

0 commit comments

Comments
 (0)