-
Notifications
You must be signed in to change notification settings - Fork 3
darnit_main.h
These bit flags are used to indicate what platform libdarnit detected/was built for.
#define DARNIT_PLATFORM_DESKTOP 0x100000
#define DARNIT_PLATFORM_HANDHELD 0x200000
#define DARNIT_PLATFORM_LINUX 0x1
#define DARNIT_PLATFORM_WIN32 0x2
#define DARNIT_PLATFORM_PANDORA 0x4
#define DARNIT_PLATFORM_GCWZERO 0x8
#define DARNIT_PLATFORM_GPHCAANOO 0x10
#define DARNIT_PLATFORM_MACOSX 0x20
#define DARNIT_PLATFORM_FREEBSD 0x40
#define DARNIT_PLATFORM_MAEMO 0x80
#define DARNIT_PLATFORM_BIGENDIAN 0x80000000There's only one of the bit-flags < 0x10000 in a DARNIT_PLATFORMS field. There can be multiple ones of those with a larger value.
typedef struct {
DARNIT_PLATFORMS platform;
unsigned int screen_w;
unsigned int screen_h;
unsigned int fullscreen;
} DARNIT_PLATFORM;- platform - Is a series of flags indicating the platform the program is running on.
- screen_w - If fully initialized, this is the current screen/window width. If not fully initialized, it's the recommended screen width.
- screen_h - Same as above, but screen/window height
- fullscreen - Same as above, but wuth fullscreen. 1 if fullscreen, 0 if not.
typedef struct {
signed short x : 16;
signed short y : 16;
unsigned short w : 16;
unsigned short h : 16;
} DARNIT_VIDEOMODE;This is a direct wrapper of SDL_ListModes, with the exception that -1 is not returned if all modes are available. That's just silly. We use NULL instead.
- x - You can't do anything with it in libdarnit, ignore
- y - Same as above
- w - Screen width for the supported mode
- h - Screen height for the supported mode
- void *d_init(const char *wtitle, const char *data_dir, const char *icon);
- void *d_init_custom(const char *wtitle, int win_w, int win_h, int fullscreen, const char *data_dir, const * char *icon);
- void d_loop();
- unsigned int d_time_get();
- int d_fps();
- int d_last_frame_time();
- [DARNIT_PLATFORM](darnit_main.h#darnit_platform d_platform_get();
- void d_quit();
- void *d_init_partial(const char *data_dir);
- int d_init_rest(const char *wtitle, int win_w, int win_h, int fullscreen, const char *icon);
- DARNIT_VIDEOMODE **d_videomode_get();
void *d_init(const char *wtitle, const char *data_dir, const char *icon);
Initializes libdarnit and creates a window with values from platform defaults.
Arguments
- wtitle - A string that will be displayed as the windows title
- data_dir - The name of the directories that store data in data and write dir path. See platform defaults for more information.
- icon - Path for the window icon. Can be in any supported image format. Can be inside an LDI file, provided it's mounted. NULL means no icon.
Return value
Returns NULL on failure, anything else is success. You do not need to save this pointer, and you can't really do anything but trouble with it.
void *d_init_custom(const char *wtitle, int win_w, int win_h, int fullscreen, const char *data_dir, const char *icon);
Creates a window with all parameters specified by the program instead of with platform defaults.
Arguments
- wtitle - A string that will be displayed as the windows title
- win_w - The width of the window to create
- win_h - The height of the window to create
- fullscreen - 1 if you want it to be full screen, 0 if not
- data_dir - The name of the directories that store data in data and write dir path. See platform defaults for more information.
- icon - Path for the window icon. Can be in any supported image format. Can be inside an LDI file, provided it's mounted. NULL means no icon.
Return value
Returns NULL on failure, anything else is success. You do not need to save this pointer, and you can't really do anything but trouble with it.