|
Kore
|
Provides basic system and application-management functionality which doesn't fit anywhere else. More...
#include <kinc/global.h>#include <kinc/log.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Typedefs | |
| typedef uint64_t | kinc_ticks_t |
Functions | |
| KINC_FUNC int | kinc_init (const char *name, int width, int height, struct kinc_window_options *win, struct kinc_framebuffer_options *frame) |
| Initializes a Kinc 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 Kinc-function with the exception of the Display-API which can optionally be initialized beforehand using kinc_display_init. | |
| KINC_FUNC const char * | kinc_application_name (void) |
| Returns the current application name as set by kinc_init or kinc_set_application_name. | |
| KINC_FUNC void | kinc_set_application_name (const char *name) |
| Changes the application-name that was initially set by kinc_init. | |
| KINC_FUNC int | kinc_width (void) |
| Returns the current width of the initial application-window which is equivalent to calling kinc_window_width(0). | |
| KINC_FUNC int | kinc_height (void) |
| Returns the current height of the initial application-window which is equivalent to calling kinc_window_height(0). | |
| KINC_FUNC void | kinc_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. | |
| KINC_FUNC const char * | kinc_system_id (void) |
| Returns an ID representing the current type of target-system. | |
| KINC_FUNC const char * | kinc_language (void) |
| Returns the current system-language. | |
| KINC_FUNC void | kinc_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. | |
| KINC_FUNC float | kinc_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. | |
| KINC_FUNC bool | kinc_automatic_safe_zone (void) |
| Returns whether the system itself handles configuration of the safe-zone. | |
| KINC_FUNC void | kinc_set_safe_zone (float value) |
| Sets the safe-zone for systems which return false for kinc_automatic_safe_zone. | |
| KINC_FUNC double | kinc_frequency (void) |
| Returns the frequency of system-timestamps. | |
| KINC_FUNC kinc_ticks_t | kinc_timestamp (void) |
| Returns a timestamp for right now in a system-specific unit. | |
| KINC_FUNC int | kinc_cpu_cores (void) |
| Returns the number of proper CPU-cores (not the number of hardware-threads). | |
| KINC_FUNC int | kinc_hardware_threads (void) |
| Returns the number of hardware-threads. | |
| KINC_FUNC double | kinc_time (void) |
| Returns the current time. This can also be calculated ala kinc_timestamp() / kinc_frequency() but kinc_time is a little more precise on some systems. | |
| KINC_FUNC void | kinc_start (void) |
| Starts Kinc's main-loop. kinc_set_update_callback should be called before kinc_start so the main-loop actually has something to do. | |
| KINC_FUNC void | kinc_stop (void) |
| Stops Kinc's main loop and thereby returns to the function which called kinc_start. | |
| KINC_FUNC void | kinc_login (void) |
| Instructs the system to login a user if that is supported. | |
| KINC_FUNC bool | kinc_waiting_for_login (void) |
| Returns true if kinc_login was called and the login-process is still ongoing. | |
| KINC_FUNC void | kinc_unlock_achievement (int id) |
| Unlocks an achievement or trophy or however you prefer to call it. | |
| KINC_FUNC void | kinc_disallow_user_change (void) |
| Disallows the system to logout the current user. | |
| KINC_FUNC void | kinc_allow_user_change (void) |
| Allows the system to logout the current user. | |
| KINC_FUNC void | kinc_set_keep_screen_on (bool on) |
| Instructs the system whether it is allowed to turn off the screen while the application is running. | |
| KINC_INLINE void | kinc_debug_break (void) |
| Tries to halt program-execution in an attached debugger when compiled in debug-mode (aka when NDEBUG is not defined). | |
| KINC_FUNC bool | kinc_debugger_attached (void) |
| Returns whether a debugger is currently attached to the running program. This is not yet working though. | |
| KINC_FUNC void | kinc_copy_to_clipboard (const char *text) |
| Copies the provided string to the system's clipboard. | |
| KINC_FUNC void | kinc_set_update_callback (void(*callback)(void *), void *data) |
| Sets the update-callback which drives the application and is called for every frame. | |
| KINC_FUNC void | kinc_set_foreground_callback (void(*callback)(void *), void *data) |
| Sets a callback which is called whenever the application is brought to the foreground. | |
| KINC_FUNC void | kinc_set_resume_callback (void(*callback)(void *), void *data) |
| Sets a callback which is called whenever the application was paused and is being resumed. | |
| KINC_FUNC void | kinc_set_pause_callback (void(*callback)(void *), void *data) |
| Sets a callback which is called whenever the application is paused. | |
| KINC_FUNC void | kinc_set_background_callback (void(*callback)(void *), void *data) |
| Sets a callback which is called whenever the application is brought to the background. | |
| KINC_FUNC void | kinc_set_shutdown_callback (void(*callback)(void *), void *data) |
| Sets a callback which is called whenever the application is about to shut down. | |
| KINC_FUNC void | kinc_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. | |
| KINC_FUNC void | kinc_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. Kinc does not take ownership of the provided string. | |
| KINC_FUNC void | kinc_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. Kinc does not take ownership of the provided string. | |
| KINC_FUNC void | kinc_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. | |
| KINC_FUNC void | kinc_set_login_callback (void(*callback)(void *), void *data) |
| Sets a callback which is called when a user logs in. | |
| KINC_FUNC void | kinc_set_logout_callback (void(*callback)(void *), void *data) |
| Sets a callback which is called when a user logs out. | |
| static void | kinc_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 | kinc_marker_end (const char *name) |
| Ends the previously started marker of the same function. | |
| KINC_FUNC void | kinc_LivePP_start (void) |
| Currently only supported on Windows. Starts up Live++ (see https://liveplusplus.tech), typically called right before kinc_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 KINC_LIVEPP-define for the Debug- and Develop-configs (it does not touch the Release-config). | |
| KINC_FUNC void | kinc_LivePP_stop (void) |
| Stops Live++, typically called right after kinc_start(). | |
Provides basic system and application-management functionality which doesn't fit anywhere else.
| KINC_FUNC const char * kinc_application_name | ( | void | ) |
Returns the current application name as set by kinc_init or kinc_set_application_name.
| KINC_FUNC bool kinc_automatic_safe_zone | ( | void | ) |
Returns whether the system itself handles configuration of the safe-zone.
| KINC_FUNC void kinc_copy_to_clipboard | ( | const char * | text | ) |
Copies the provided string to the system's clipboard.
| text | The text to be copied into the clipboard |
| KINC_FUNC int kinc_cpu_cores | ( | void | ) |
Returns the number of proper CPU-cores (not the number of hardware-threads).
| KINC_FUNC bool kinc_debugger_attached | ( | void | ) |
Returns whether a debugger is currently attached to the running program. This is not yet working though.
| KINC_FUNC double kinc_frequency | ( | void | ) |
Returns the frequency of system-timestamps.
| KINC_FUNC int kinc_hardware_threads | ( | void | ) |
Returns the number of hardware-threads.
| KINC_FUNC int kinc_height | ( | void | ) |
Returns the current height of the initial application-window which is equivalent to calling kinc_window_height(0).
| KINC_FUNC int kinc_init | ( | const char * | name, |
| int | width, | ||
| int | height, | ||
| struct kinc_window_options * | win, | ||
| struct kinc_framebuffer_options * | frame ) |
Initializes a Kinc 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 Kinc-function with the exception of the Display-API which can optionally be initialized beforehand using kinc_display_init.
| KINC_FUNC const char * kinc_language | ( | void | ) |
Returns the current system-language.
| KINC_FUNC void kinc_LivePP_start | ( | void | ) |
Currently only supported on Windows. Starts up Live++ (see https://liveplusplus.tech), typically called right before kinc_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 KINC_LIVEPP-define for the Debug- and Develop-configs (it does not touch the Release-config).
| KINC_FUNC void kinc_LivePP_stop | ( | void | ) |
Stops Live++, typically called right after kinc_start().
| KINC_FUNC void kinc_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 |
| KINC_FUNC float kinc_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.
| KINC_FUNC void kinc_set_application_name | ( | const char * | name | ) |
Changes the application-name that was initially set by kinc_init.
| name | The new application-name |
| KINC_FUNC void kinc_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 |
| KINC_FUNC void kinc_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. Kinc does not take ownership of the provided string.
| callback | The copy-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| KINC_FUNC void kinc_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. Kinc does not take ownership of the provided string.
| callback | The cut-callback |
| data | Arbitrary data-pointer that's passed to the callback |
| KINC_FUNC void kinc_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 |
| KINC_FUNC void kinc_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 |
| KINC_FUNC void kinc_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 |
| KINC_FUNC void kinc_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 |
| KINC_FUNC void kinc_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 |
| KINC_FUNC void kinc_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 |
| KINC_FUNC void kinc_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 |
| KINC_FUNC void kinc_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 |
| KINC_FUNC void kinc_set_safe_zone | ( | float | value | ) |
Sets the safe-zone for systems which return false for kinc_automatic_safe_zone.
| value | The safe-zone for width and height as a ratio of the full display-resolution. |
| KINC_FUNC void kinc_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 |
| KINC_FUNC void kinc_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 |
| KINC_FUNC const char * kinc_system_id | ( | void | ) |
Returns an ID representing the current type of target-system.
| KINC_FUNC double kinc_time | ( | void | ) |
Returns the current time. This can also be calculated ala kinc_timestamp() / kinc_frequency() but kinc_time is a little more precise on some systems.
| KINC_FUNC kinc_ticks_t kinc_timestamp | ( | void | ) |
Returns a timestamp for right now in a system-specific unit.
| KINC_FUNC void kinc_unlock_achievement | ( | int | id | ) |
Unlocks an achievement or trophy or however you prefer to call it.
| id | The id of the achievement/tropy |
| KINC_FUNC bool kinc_waiting_for_login | ( | void | ) |
Returns true if kinc_login was called and the login-process is still ongoing.
| KINC_FUNC int kinc_width | ( | void | ) |
Returns the current width of the initial application-window which is equivalent to calling kinc_window_width(0).