CShellEngine is a framework library designed to help set up the boilerplate for C-based terminal games and applications.
- 3D/2D grid system.
- Rendering of grid system.
- Keyboard input handling.
- Random number generation.
- Game loop handling.
- Delta time for game loop system.
- Datatypes such as:
Vector2i,Vector3i,Vector2f,Vector3f.
+ Linux: Tested, supported.
- Windows: Untested, currently unsupported.
! macOS: Untested, expected to work (may require specific terminal settings/environment).Simply include the headers you need in your C program.
And make sure to include all C source files in compilation.
#include "Core.h"
#include "Rendering.h"
#include "Input.h"
void game_loop() {
printf("main method.\n");
Core___game_loop_quit_flag = true;
}
void render() {
Rendering___render(NULL);
}
int main() {
Vector3i grid_size_ = {3, 1, 2};
Core___initCore(&grid_size_, &game_loop, NULL);
Rendering___init(NULL);
Input___setInputMode(false, false);
Rendering___setMapping(1, "Hello World!\n");
Core___grid[0][0][0] = 1;
while (!Input___isKeyPressed('a')); // wait for 'a' key
printf("\na pressed\n");
printf("%c pressed\n", Input___getKey()); // wait for and print pressed key
Core___startGameLoop(&render);
printf("\ndelta time: %f\nrender time: %f\n", Core___delta_time, Rendering___render_time);
Rendering___cleanup(NULL);
Core___cleanupCore(NULL);
Input___setInputMode(true, true);
return 0;
}