diff --git a/.vscode/settings.json b/.vscode/settings.json index b5601daaa..c71a2653d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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 } \ No newline at end of file diff --git a/public/usage-examples/timers/timer_ticks-1-example-oop.cs b/public/usage-examples/timers/timer_ticks-1-example-oop.cs new file mode 100644 index 000000000..bb995c903 --- /dev/null +++ b/public/usage-examples/timers/timer_ticks-1-example-oop.cs @@ -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; + } + } + } +} \ No newline at end of file diff --git a/public/usage-examples/timers/timer_ticks-1-example-top-level.cs b/public/usage-examples/timers/timer_ticks-1-example-top-level.cs new file mode 100644 index 000000000..ecc3e7cfb --- /dev/null +++ b/public/usage-examples/timers/timer_ticks-1-example-top-level.cs @@ -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; + } +} \ No newline at end of file diff --git a/public/usage-examples/timers/timer_ticks-1-example.cpp b/public/usage-examples/timers/timer_ticks-1-example.cpp new file mode 100644 index 000000000..f43424246 --- /dev/null +++ b/public/usage-examples/timers/timer_ticks-1-example.cpp @@ -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; +} \ No newline at end of file diff --git a/public/usage-examples/timers/timer_ticks-1-example.png b/public/usage-examples/timers/timer_ticks-1-example.png new file mode 100644 index 000000000..a8f286e46 Binary files /dev/null and b/public/usage-examples/timers/timer_ticks-1-example.png differ diff --git a/public/usage-examples/timers/timer_ticks-1-example.py b/public/usage-examples/timers/timer_ticks-1-example.py new file mode 100644 index 000000000..179ed9e50 --- /dev/null +++ b/public/usage-examples/timers/timer_ticks-1-example.py @@ -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() \ No newline at end of file diff --git a/public/usage-examples/timers/timer_ticks-1-example.txt b/public/usage-examples/timers/timer_ticks-1-example.txt new file mode 100644 index 000000000..a74a87df2 --- /dev/null +++ b/public/usage-examples/timers/timer_ticks-1-example.txt @@ -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. \ No newline at end of file