|
Kore 3
|
Provides basic system and application-management functionality which doesn't fit anywhere else. More...
#include <kore3/global.h>#include <kore3/log.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Typedefs | |
| typedef uint64_t | kore_ticks |
Functions | |
| 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 (systems which do not support windows are treated as if the would provide a single window which cannot change). This has to be called before any other Kore-function with the exception of the Display-API which can optionally be initialized beforehand using kore_display_init. | |
| KORE_FUNC const char * | kore_application_name (void) |
| Returns the current application name as set by kore_init or kore_set_application_name. | |
| KORE_FUNC void | kore_set_application_name (const char *name) |
| Changes the application-name that was initially set by kore_init. | |
| KORE_FUNC int | kore_width (void) |
| Returns the current width of the initial application-window which is equivalent to calling kore_window_width(0). | |
| KORE_FUNC int | kore_height (void) |
| Returns the current height of the initial application-window which is equivalent to calling kore_window_height(0). | |
| 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 browser. | |
| KORE_FUNC const char * | kore_system_id (void) |
| Returns an ID representing the current type of target-system. | |
| KORE_FUNC const char * | kore_language (void) |
| Returns the current system-language. | |
| KORE_FUNC void | kore_vibrate (int milliseconds) |
| Vibrates the whole system if supported. This is primarily supported on mobile phones but don't blame us if your computer falls over. | |
| KORE_FUNC float | kore_safe_zone (void) |
| Returns the portion of the screen which can be safely used for important content. This is mostly relevant for TVs which often scale the image by default and thefore cut off some of the content. | |
| KORE_FUNC bool | kore_automatic_safe_zone (void) |
| Returns whether the system itself handles configuration of the safe-zone. | |
| 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 double | kore_frequency (void) |
| Returns the frequency of system-timestamps. | |
| KORE_FUNC kore_ticks | kore_timestamp (void) |
| Returns a timestamp for right now in a system-specific unit. | |
| KORE_FUNC int | kore_cpu_cores (void) |
| Returns the number of proper CPU-cores (not the number of hardware-threads). | |
| KORE_FUNC int | kore_hardware_threads (void) |
| Returns the number of hardware-threads. | |
| KORE_FUNC double | kore_time (void) |
| Returns the current time. This can also be calculated ala kore_timestamp() / kore_frequency() but kore_time is a little more precise on some systems. | |
| 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 actually has something to do. | |
| KORE_FUNC void | kore_stop (void) |
| Stops Kore's main loop and thereby returns to the function which called kore_start. | |
| KORE_FUNC void | kore_login (void) |
| Instructs the system to login a user if that is supported. | |
| KORE_FUNC bool | kore_waiting_for_login (void) |
| Returns true if kore_login was called and the login-process is still ongoing. | |
| KORE_FUNC void | kore_unlock_achievement (int id) |
| Unlocks an achievement or trophy or however you prefer to call it. | |
| KORE_FUNC void | kore_disallow_user_change (void) |
| Disallows the system to logout the current user. | |
| KORE_FUNC void | kore_allow_user_change (void) |
| Allows the system to logout the current user. | |
| 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_INLINE void | kore_debug_break (void) |
| Tries to halt program-execution in an attached debugger when compiled in debug-mode (aka when NDEBUG is not defined). | |
| KORE_FUNC bool | kore_debugger_attached (void) |
| Returns whether a debugger is currently attached to the running program. This is not yet working though. | |
| KORE_FUNC void | kore_copy_to_clipboard (const char *text) |
| Copies the provided string to the system's clipboard. | |
| 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. | |
| 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. | |
| 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_pause_callback (void(*callback)(void *), void *data) |
| Sets a callback which is called whenever the application is paused. | |
| 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 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 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_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 cmd+x. Kore does not take ownership of the provided string. | |
| 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 cmd+c. Kore does not take ownership of the provided string. | |
| 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 cmd+v. The provided string is only valid during the callback-call - copy it if you want to keep it. | |
| 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 void | kore_set_logout_callback (void(*callback)(void *), void *data) |
| Sets a callback which is called when a user logs out. | |
| 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. | |
| static void | kore_marker_end (const char *name) |
| Ends the previously started marker of the same function. | |
| KORE_FUNC void | kore_LivePP_start (void) |
| Currently only supported on Windows. Starts up Live++ (see https://liveplusplus.tech), typically called right before kore_start(). After calling this you can hit Ctrl+Alt+F11 to hot-reload. Call Project.addLivePP(path) in your kfile to make this do something. The path-parameter for addLivePP is the path to the unpacked Live++-archive that has to contain a LivePP-subdirectory. This will set the appropricate compiler- and linker-options and set the KORE_LIVEPP-define for the Debug- and Develop-configs (it does not touch the Release-config). | |
| KORE_FUNC void | kore_LivePP_stop (void) |
| Stops Live++, typically called right after kore_start(). | |
Provides basic system and application-management functionality which doesn't fit anywhere else.
| KORE_FUNC const char * kore_application_name | ( | void | ) |
Returns the current application name as set by kore_init or kore_set_application_name.
| KORE_FUNC bool kore_automatic_safe_zone | ( | void | ) |
Returns whether the system itself handles configuration of the safe-zone.
| KORE_FUNC void kore_copy_to_clipboard | ( | const char * | text | ) |
Copies the provided string to the system's clipboard.
| text | The text to be copied into the clipboard |
| KORE_FUNC int kore_cpu_cores | ( | void | ) |
Returns the number of proper CPU-cores (not the number of hardware-threads).
| KORE_FUNC bool kore_debugger_attached | ( | void | ) |
Returns whether a debugger is currently attached to the running program. This is not yet working though.
| KORE_FUNC double kore_frequency | ( | void | ) |
Returns the frequency of system-timestamps.
| KORE_FUNC int kore_hardware_threads | ( | void | ) |
Returns the number of hardware-threads.
| KORE_FUNC int kore_height | ( | void | ) |
Returns the current height of the initial application-window which is equivalent to calling kore_window_height(0).
| 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 (systems which do not support windows are treated as if the would provide a single window which cannot change). This has to be called before any other Kore-function with the exception of the Display-API which can optionally be initialized beforehand using kore_display_init.
| KORE_FUNC const char * kore_language | ( | void | ) |
Returns the current system-language.
| KORE_FUNC void kore_LivePP_start | ( | void | ) |
Currently only supported on Windows. Starts up Live++ (see https://liveplusplus.tech), typically called right before kore_start(). After calling this you can hit Ctrl+Alt+F11 to hot-reload. Call Project.addLivePP(path) in your kfile to make this do something. The path-parameter for addLivePP is the path to the unpacked Live++-archive that has to contain a LivePP-subdirectory. This will set the appropricate compiler- and linker-options and set the KORE_LIVEPP-define for the Debug- and Develop-configs (it does not touch the Release-config).
| KORE_FUNC void kore_LivePP_stop | ( | void | ) |
Stops Live++, typically called right after kore_start().
| 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 browser.
| url | The URL to open |
|
inlinestatic |
Starts a marker for profiling. Please match it with a marker_end-call in the same function.
| name | A unique name that will be shown in the profiler |
| color | A nice color in RGBX that will show up in the profiler |
| KORE_FUNC float kore_safe_zone | ( | void | ) |
Returns the portion of the screen which can be safely used for important content. This is mostly relevant for TVs which often scale the image by default and thefore cut off some of the content.
| KORE_FUNC void kore_set_application_name | ( | const char * | name | ) |
Changes the application-name that was initially set by kore_init.
| name | The new application-name |
| 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.
| callback | The background-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| 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 cmd+c. Kore does not take ownership of the provided string.
| callback | The copy-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| 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 cmd+x. Kore does not take ownership of the provided string.
| callback | The cut-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| 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.
| callback | The drop-files-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| 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.
| callback | The foreground-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| 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.
| on | Whether turning off the screen is allowed |
| KORE_FUNC void kore_set_login_callback | ( | void(* | callback )(void *), |
| void * | data ) |
Sets a callback which is called when a user logs in.
| callback | The login-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| KORE_FUNC void kore_set_logout_callback | ( | void(* | callback )(void *), |
| void * | data ) |
Sets a callback which is called when a user logs out.
| callback | The logout-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| 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 cmd+v. The provided string is only valid during the callback-call - copy it if you want to keep it.
| callback | The paste-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| KORE_FUNC void kore_set_pause_callback | ( | void(* | callback )(void *), |
| void * | data ) |
Sets a callback which is called whenever the application is paused.
| callback | The pause-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| 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.
| callback | The resume-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| KORE_FUNC void kore_set_safe_zone | ( | float | value | ) |
Sets the safe-zone for systems which return false for kore_automatic_safe_zone.
| value | The safe-zone for width and height as a ratio of the full display-resolution. |
| 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.
| callback | The shutdown-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| 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.
| callback | The callback |
| data | Arbitrary data-pointer that's passed to the callback |
| KORE_FUNC const char * kore_system_id | ( | void | ) |
Returns an ID representing the current type of target-system.
| KORE_FUNC double kore_time | ( | void | ) |
Returns the current time. This can also be calculated ala kore_timestamp() / kore_frequency() but kore_time is a little more precise on some systems.
| KORE_FUNC kore_ticks kore_timestamp | ( | void | ) |
Returns a timestamp for right now in a system-specific unit.
| KORE_FUNC void kore_unlock_achievement | ( | int | id | ) |
Unlocks an achievement or trophy or however you prefer to call it.
| id | The id of the achievement/tropy |
| 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_width | ( | void | ) |
Returns the current width of the initial application-window which is equivalent to calling kore_window_width(0).