-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
SpectatorEx edited this page Jan 3, 2024
·
1 revision
A small code example that demonstrates some of the library's functions.
#include <stdio.h>
#include <time.h>
#include "cengine32.h"
int main(void) {
console_color color;
short width = 0, height = 0;
short i, j;
console_title("CEngine32");
console_set_font(L"Courier New", 7, 16, 1000);
console_cursor_info(FALSE, 1);
console_get_window_size(&width, &height);
srand(time(NULL));
printf("Width: %d\nHeight: %d", width, height);
while (TRUE) {
for (i = 0; i < 10; i++) {
console_cursor_pos(width / 2 - 36, height / 2 - 5 + i);
for (j = 0; j < 12; j++) {
color = rand() % 255 + 1;
console_set_color(color);
printf("%-6d", color);
}
}
if (console_key_down(KEY_ENTER)) {
break;
}
Sleep(300);
}
return 0;
}Output:
