cf_make_app¶
Category: app
GitHub: cute_app.h
Use this function to construct an instance of your application window and (optionally) initialize graphics.
CF_Result cf_make_app(const char* window_title, CF_DisplayID display_id, int x, int y, int w, int h, CF_AppOptionFlags options, const char* argv0);
Parameters | Description |
---|---|
window_title | The title of the window in utf8 encoding. |
display_index | The index of the display to spawn upon. Set this to zero for the primary display. See cf_get_display_list. |
x | The x position of the window. |
y | The y position of the window. |
w | The width of the window in pixels. |
h | The height of the window in pixels. |
options | 0 by default; a bitmask of app_options flags. |
argv0 | The first argument passed to your main function in the argv parameter. |
Return Value¶
Returns any errors on failure as a CF_Result.
Code Example¶
Creating a basic 640x480 window for your game.
#include <cute.h>
using namespace cute;
int main(int argc, const char argv)
{
// Create a window with a resolution of 640 x 480, along with a DirectX 11 context.
app_make("Fancy Window Title", 0, 50, 50, 640, 480, CF_APP_OPTIONS_RESIZABLE_BIT, argv[0]);
while (app_is_running())
{
app_update();
// All your game logic and updates go here...
app_draw_onto_screen();
}
app_destroy();
return 0;
}
Remarks¶
The options parameter is an enum from app_options
. Different options can be OR'd together.
Parameters w
and h
are ignored if the window is initialized to fullscreen mode with APP_OPTIONS_FULLSCREEN
.
Related Pages¶
CF_AppOptionFlagBits
cf_app_is_running
cf_app_signal_shutdown
cf_destroy_app