Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,62 @@
{
"files.associations": {
"*.mdx": "markdown"
}
},
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false
}
31 changes: 31 additions & 0 deletions public/usage-examples/timers/timer_ticks-1-example-oop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using SplashKitSDK;

public class Program
{
public static void Main()
{
SplashKit.OpenWindow("timer_ticks Example", 800, 600);

SplashKit.CreateTimer("demo timer");
SplashKit.StartTimer("demo timer");

while (!SplashKit.WindowCloseRequested("timer_ticks Example"))
{
SplashKit.ProcessEvents();
SplashKit.ClearScreen(Color.White);

long elapsed = SplashKit.TimerTicks("demo timer");

SplashKit.DrawText("timer_ticks Example", Color.Black, 20, 20);
SplashKit.DrawText("Elapsed time (ms): " + elapsed, Color.Blue, 20, 70);
SplashKit.DrawText("This value increases while the timer is running.", Color.DarkGreen, 20, 120);

SplashKit.RefreshScreen(60);

if (elapsed > 5000)
{
break;
}
}
}
}
25 changes: 25 additions & 0 deletions public/usage-examples/timers/timer_ticks-1-example-top-level.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using SplashKitSDK;

SplashKit.OpenWindow("timer_ticks Example", 800, 600);

SplashKit.CreateTimer("demo timer");
SplashKit.StartTimer("demo timer");

while (!SplashKit.WindowCloseRequested("timer_ticks Example"))
{
SplashKit.ProcessEvents();
SplashKit.ClearScreen(Color.White);

long elapsed = SplashKit.TimerTicks("demo timer");

SplashKit.DrawText("timer_ticks Example", Color.Black, 20, 20);
SplashKit.DrawText("Elapsed time (ms): " + elapsed, Color.Blue, 20, 70);
SplashKit.DrawText("This value increases while the timer is running.", Color.DarkGreen, 20, 120);

SplashKit.RefreshScreen(60);

if (elapsed > 5000)
{
break;
}
}
30 changes: 30 additions & 0 deletions public/usage-examples/timers/timer_ticks-1-example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "splashkit.h"

int main()
{
open_window("timer_ticks Example", 800, 600);

create_timer("demo timer");
start_timer("demo timer");

while (!window_close_requested("timer_ticks Example"))
{
process_events();
clear_screen(COLOR_WHITE);

int elapsed = timer_ticks("demo timer");

draw_text("timer_ticks Example", COLOR_BLACK, 20, 20);
draw_text("Elapsed time (ms): " + std::to_string(elapsed), COLOR_BLUE, 20, 70);
draw_text("This value increases while the timer is running.", COLOR_DARK_GREEN, 20, 120);

refresh_screen(60);

if (elapsed > 5000)
{
break;
}
}

return 0;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions public/usage-examples/timers/timer_ticks-1-example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from splashkit import *

window = open_window("timer_ticks Example", 800, 600)

timer = create_timer("demo timer")
start_timer(timer)

font = get_system_font()

while not window_close_requested(window):
process_events()
clear_screen(color_white())

elapsed = timer_ticks(timer)

draw_text("timer_ticks Example", color_black(), font, 24, 20, 20)
draw_text("Elapsed time (ms): " + str(elapsed), color_blue(), font, 24, 20, 70)
draw_text("This value increases while the timer is running.", color_green(), font, 24, 20, 120)

refresh_screen()

if elapsed > 5000:
break

close_all_windows()
7 changes: 7 additions & 0 deletions public/usage-examples/timers/timer_ticks-1-example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
timer_ticks Usage Example

This example demonstrates how to use timer_ticks to read the elapsed time of a timer in SplashKit.

The program creates a timer, starts it, and displays the current timer value in milliseconds in a window.

This helps show how timer_ticks changes over time while the program is running.