1#ifndef KORE_SYSTEM_HEADER
2#define KORE_SYSTEM_HEADER
97typedef uint64_t kore_ticks;
179#elif defined(__clang__)
180 __builtin_debugtrap();
182#if defined(__aarch64__)
183 __asm__
volatile(
".inst 0xd4200000");
184#elif defined(__x86_64__)
185 __asm__
volatile(
"int $0x03");
187 kore_log(KORE_LOG_LEVEL_WARNING,
"Oh no, kore_debug_break is not implemented for the current compiler and CPU.");
293#include <ittnotify.h>
295extern __itt_domain *kore_itt_domain;
298#ifdef KORE_SUPERLUMINAL
299#include <Superluminal/PerformanceAPI_capi.h>
309 __itt_task_begin(kore_itt_domain, __itt_null, __itt_null, __itt_string_handle_create(name));
312#ifdef KORE_SUPERLUMINAL
313 PerformanceAPI_BeginEvent(name, NULL, color);
322 __itt_task_end(kore_itt_domain);
325#ifdef KORE_SUPERLUMINAL
326 PerformanceAPI_EndEvent();
349bool kore_internal_frame(
void);
350const char *kore_internal_save_path(
void);
351bool kore_internal_handle_messages(
void);
352void kore_internal_shutdown(
void);
353void kore_internal_update_callback(
void);
354void kore_internal_foreground_callback(
void);
355void kore_internal_resume_callback(
void);
356void kore_internal_pause_callback(
void);
357void kore_internal_background_callback(
void);
358void kore_internal_shutdown_callback(
void);
359void kore_internal_drop_files_callback(
wchar_t *);
360char *kore_internal_cut_callback(
void);
361char *kore_internal_copy_callback(
void);
362void kore_internal_paste_callback(
char *);
363void kore_internal_login_callback(
void);
364void kore_internal_logout_callback(
void);
Provides basic functionality that's used all over the place. There's usually no need to manually incl...
Contains basic logging functionality.
KORE_FUNC void kore_log(kore_log_level log_level, const char *format,...)
Logging function similar to printf including some system-specific bonuses.
KORE_FUNC const char * kore_system_id(void)
Returns an ID representing the current type of target-system.
KORE_FUNC int kore_hardware_threads(void)
Returns the number of hardware-threads.
KORE_FUNC void kore_copy_to_clipboard(const char *text)
Copies the provided string to the system's clipboard.
KORE_FUNC void kore_allow_user_change(void)
Allows the system to logout the current user.
KORE_FUNC void kore_stop(void)
Stops Kore's main loop and thereby returns to the function which called kore_start.
KORE_FUNC int kore_width(void)
Returns the current width of the initial application-window which is equivalent to calling kore_windo...
KORE_FUNC double kore_frequency(void)
Returns the frequency of system-timestamps.
KORE_FUNC int kore_cpu_cores(void)
Returns the number of proper CPU-cores (not the number of hardware-threads).
KORE_FUNC void kore_set_copy_callback(char *(*callback)(void *), void *data)
Sets a callback which is called when the application is instructed to copy, typically via ctrl+c or c...
KORE_FUNC void kore_unlock_achievement(int id)
Unlocks an achievement or trophy or however you prefer to call it.
KORE_FUNC void kore_LivePP_stop(void)
Stops Live++, typically called right after kore_start().
KORE_FUNC void kore_set_login_callback(void(*callback)(void *), void *data)
Sets a callback which is called when a user logs in.
KORE_FUNC int kore_height(void)
Returns the current height of the initial application-window which is equivalent to calling kore_wind...
KORE_FUNC void kore_set_shutdown_callback(void(*callback)(void *), void *data)
Sets a callback which is called whenever the application is about to shut down.
KORE_FUNC kore_ticks kore_timestamp(void)
Returns a timestamp for right now in a system-specific unit.
KORE_INLINE void kore_debug_break(void)
Tries to halt program-execution in an attached debugger when compiled in debug-mode (aka when NDEBUG ...
Definition system.h:175
KORE_FUNC void kore_set_foreground_callback(void(*callback)(void *), void *data)
Sets a callback which is called whenever the application is brought to the foreground.
static void kore_marker_end(const char *name)
Ends the previously started marker of the same function.
Definition system.h:320
KORE_FUNC void kore_set_background_callback(void(*callback)(void *), void *data)
Sets a callback which is called whenever the application is brought to the background.
KORE_FUNC bool kore_debugger_attached(void)
Returns whether a debugger is currently attached to the running program. This is not yet working thou...
KORE_FUNC const char * kore_language(void)
Returns the current system-language.
KORE_FUNC void kore_set_drop_files_callback(void(*callback)(wchar_t *, void *), void *data)
Sets a callback which is called when files are dropped on the application-window.
KORE_FUNC void kore_set_safe_zone(float value)
Sets the safe-zone for systems which return false for kore_automatic_safe_zone.
KORE_FUNC void kore_set_pause_callback(void(*callback)(void *), void *data)
Sets a callback which is called whenever the application is paused.
KORE_FUNC float kore_safe_zone(void)
Returns the portion of the screen which can be safely used for important content. This is mostly rele...
KORE_FUNC void kore_set_paste_callback(void(*callback)(char *, void *), void *data)
Sets a callback which is called when the application is instructed to paste, typically via ctrl+v or ...
KORE_FUNC void kore_start(void)
Starts Kore's main-loop. kore_set_update_callback should be called before kore_start so the main-loop...
KORE_FUNC void kore_set_resume_callback(void(*callback)(void *), void *data)
Sets a callback which is called whenever the application was paused and is being resumed.
KORE_FUNC void kore_set_keep_screen_on(bool on)
Instructs the system whether it is allowed to turn off the screen while the application is running.
KORE_FUNC void kore_set_logout_callback(void(*callback)(void *), void *data)
Sets a callback which is called when a user logs out.
KORE_FUNC void kore_LivePP_start(void)
Currently only supported on Windows. Starts up Live++ (see https://liveplusplus.tech),...
KORE_FUNC double kore_time(void)
Returns the current time. This can also be calculated ala kore_timestamp() / kore_frequency() but kor...
KORE_FUNC void kore_vibrate(int milliseconds)
Vibrates the whole system if supported. This is primarily supported on mobile phones but don't blame ...
KORE_FUNC void kore_set_cut_callback(char *(*callback)(void *), void *data)
Sets a callback which is called when the application is instructed to cut, typically via ctrl+x or cm...
KORE_FUNC bool kore_waiting_for_login(void)
Returns true if kore_login was called and the login-process is still ongoing.
KORE_FUNC int kore_init(const char *name, int width, int height, struct kore_window_parameters *win, struct kore_framebuffer_parameters *frame)
Initializes a Kore application and creates an initial window for systems which support windows (syste...
KORE_FUNC void kore_load_url(const char *url)
Instruct the system to load up the provided URL which will usually open it in the system's default br...
KORE_FUNC void kore_set_application_name(const char *name)
Changes the application-name that was initially set by kore_init.
KORE_FUNC void kore_disallow_user_change(void)
Disallows the system to logout the current user.
KORE_FUNC void kore_login(void)
Instructs the system to login a user if that is supported.
KORE_FUNC bool kore_automatic_safe_zone(void)
Returns whether the system itself handles configuration of the safe-zone.
KORE_FUNC void kore_set_update_callback(void(*callback)(void *), void *data)
Sets the update-callback which drives the application and is called for every frame.
static void kore_marker_start(const char *name, uint32_t color)
Starts a marker for profiling. Please match it with a marker_end-call in the same function.
Definition system.h:307
KORE_FUNC const char * kore_application_name(void)
Returns the current application name as set by kore_init or kore_set_application_name.