-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Include kaliumn.c and kaliumn.h with your project and link winmm when compiling.
At the top of your c file:
#include "kaliumn.h"
When compiling (MinGW):
gcc [file-name].c kaliumn.c -o [file-name] -lwinmm
You can easily change the color of the text using KAL_SetColor().
KAL_SetColor(40, 30);
Printf("Red Foreground, Blue BackGround");
These are the color codes used by all functions in this project:
You can change the position of the cursor using KAL_SetCursorPosition().
KAL_SetCursorPosition(15, 20);
This moves the cursor to x = 15, y = 20.
(0, 0) is the top-left corner.
Also you can show/hide the cursor using KAL_SetCursorVisibility().
You can change the window size using KAL_SetScreenSize() and the title using KAL_SetScreenTitle().
KAL_SetScreenSize(30, 20);
KAL_SetScreenTitle("Hello World!");
This sets the window size to 30 * 20 and the title to Hello World!
You can play audio using KAL_PlayAudio(), pause it with KAL_PauseAudio(), resume it with KAL_ResumeAudio(), and stop it with KAL_StopAudio().
First, load a mp3 file using KAL_LoadAudio().
int music = KAL_LoadAudio("music.mp3");
Now you can play, pause resume and stop the audio file.
KAL_PlayAudio("sound.mp3", 0);
Sleep(1000);
KAL_PauseAudio("sound.mp3");
Sleep(1000);
KAL_ResumeAudio("sound.mp3");
Sleep(1000);
KAL_StopAudio("sound.mp3");
First, initialize the canvas and window.
KAL_Startup(30, 20, "Drawing");
KAL_InitCanvas(30, 20, 71);
This will initialize the canvas with a width of 30px and a height of 20px. The background color will be white.
Instead of KAL_Startup() you can also use KAL_SetScreenSize() and KAL_SetScreenTitle() but KAL_Startup() also hides the cursor, sets the console encoding to utf-8, and disables quick edit.
Next, load a texture and draw it to the canvas.
int *newTexture = KAL_LoadTexture("texture");
KAL_DrawTexture(newTexture, 5, 10);
This will draw the texture to the canvas. The top-left corner of the texture will be positioned at (5, 10).
The texture file can be easily made or edited by the Texture Editor.
Texture Format Example
6,・4 71・71・71・71・71・71・ 71・71・40・40・71・71・ 71・71・40・70・71・71・ 71・71・71・71・71・71・
This is a 6 * 4 texture with a red square on a white background.
Finally, display the canvas to the screen.
KAL_Display();
You can also draw text using KAL_DrawText() or individual pixel using KAL_DrawPixel().
When making animations use KAL_CleanCanvas() to clean the canvas before drawing the next frame.