Create a context and initialize a window

Before you can create your application's background window, you must create a context.

Call the screen_create_context() function with the SCREEN_APPLICATION_CONTEXT flag to set up a connection with the windowing system that lets you create windows and control some of their properties. When you use the SCREEN_APPLICATION_CONTEXT flag, you cannot use the resulting context to control windows created by other applications.

screen_context_t screen_ctx;
screen_create_context(&screen_ctx, SCREEN_APPLICATION_CONTEXT);

Create the application window — this sample uses a single application window.

screen_window_t screen_win;
	screen_create_window(&screen_win, screen_ctx);

The default buffer usage is read/write. This sample uses blits and fills, so change the usage to native. You don't need a pointer to the buffers, so there's no need to add read/write to the usage.

int usage = SCREEN_USAGE_NATIVE;
screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_USAGE, &usage);