Graphics
Refresh Screen Examples*
House Drawing
The following code shows examples of using Refresh Screen to show how double buffering works.
#include "splashkit.h"
int main(){ open_window("House Drawing", 800, 600);
clear_screen(COLOR_WHITE); refresh_screen(); delay(1000); fill_ellipse(COLOR_BRIGHT_GREEN, 0, 400, 800, 400); refresh_screen(); delay(1000); fill_rectangle(COLOR_GRAY, 300, 300, 200, 200); refresh_screen(); delay(1000); fill_triangle(COLOR_RED, 250, 300, 400, 150, 550, 300); refresh_screen(); delay(5000);
close_all_windows();
return 0;}
using static SplashKitSDK.SplashKit;
OpenWindow("House Drawing", 800, 600);
ClearScreen(ColorWhite());RefreshScreen();Delay(1000);FillEllipse(ColorBrightGreen(), 0, 400, 800, 400);RefreshScreen();Delay(1000);FillRectangle(ColorGray(), 300, 300, 200, 200);RefreshScreen();Delay(1000);FillTriangle(ColorRed(), 250, 300, 400, 150, 550, 300);RefreshScreen();Delay(5000);
CloseAllWindows();
Output:
Draw Bitmap Examples*
Basic Bitmap Drawing
The following code shows an example of using Draw Bitmap to display a Bitmap image of the SplashKit logo in a graphics Window.
#include "splashkit.h"
int main(){ open_window("Basic Bitmap Drawing", 315, 330);
load_bitmap("skbox", "skbox.png"); // Load bitmap image
while (!quit_requested()) { process_events();
clear_screen(rgb_color(67, 80, 175)); draw_bitmap("skbox", 50, 50); // draw bitmap image refresh_screen(); } close_all_windows();
return 0;}
using static SplashKitSDK.SplashKit;
OpenWindow("Basic Bitmap Drawing", 315, 330);
LoadBitmap("skbox", "skbox.png"); // Load bitmap image
while (!QuitRequested()){ ProcessEvents();
ClearScreen(RGBColor(67, 80, 175)); DrawBitmap("skbox", 50, 50); // draw bitmap image RefreshScreen();}CloseAllWindows();
Output:
Fill Triangle Examples*
Simple Red Triangle
The following code demonstrates how to use the Fill Triangle function to draw a simple red-colored filled triangle. It creates a triangle with specified coordinates and fills it with red color.
#include "splashkit.h"
int main(){ open_window("Fill triangle Example", 800, 600); clear_screen();
fill_triangle(COLOR_RED, 100, 100, 200, 200, 300, 100); refresh_screen();
delay(5000); close_all_windows();
return 0;}
using SplashKitSDK;using static SplashKitSDK.SplashKit;
OpenWindow("Fill Triangle Example", 800, 600);ClearScreen();
FillTriangle(ColorRed(), 100, 100, 200, 200, 300, 100);RefreshScreen();
Delay(5000);CloseAllWindows();
Output: