Source file containing Core and Options.
Code Map
//! Source file containing Core and Options.
module charge.core;
//! Enum for selecting subsystems.
enum Flag
{
CTL,
GFX,
SFX,
NET,
PHY,
AUTO,
}
//! Enum for selecting window mode.
enum WindowMode
{
Normal,
FullscreenDesktop,
Fullscreen,
}
//! Options at initialization.
class Options
{
public:
width: u32;
height: u32;
title: string;
flags: Flag;
windowMode: WindowMode;
openglDebug: bool;
public:
this() { }
}
//! Class holding the entire thing together.
class Core
{
public:
enum DefaultWidth;
enum DefaultHeight;
enum DefaultFullscreen;
enum DefaultFullscreenAutoSize;
enum DefaultTitle;
enum DefaultForceResizeEnable;
enum DefaultWindowMode;
public:
flags: Flag;
resizeSupported: bool;
verbosePrinting: bool;
public:
//! Sets callback functions.
fn setUpdateActions(dgt: void delegate(i64));
//! Sets callback functions.
fn setLogic(dgt: void delegate());
//! Sets callback functions.
fn setRender(dgt: void delegate(gfx.Target, gfx.ViewInfo));
//! Sets callback functions.
fn setClose(dgt: void delegate());
//! Sets callback functions.
fn setIdle(dgt: void delegate(i64));
//! Main loop functions, you should expect that this function returns. Best
//! usage is if you in your main function do this "return c.loop();".
fn loop() i32;
//! Signal the core to quit, will return from loop.
fn quit(i32);
//! Display a panic message, usually a dialogue box, then calls exit(-1),
//! so this function does not return.
fn panic(message: string);
//! Returns text from the clipboard, should any be in it.
fn getClipboardText() string;
fn resize(w: u32, h: u32, mode: WindowMode);
fn size(w: u32, h: u32, mode: WindowMode);
fn screenShot();
protected:
global gInitFuncs: fn () (void)[];
global gCloseFuncs: fn () (void)[];
}
//! Get a new core created with the given flags.
fn start(opts: Options) Core;
//! Return the current core.
fn get() Core;
//! These functions are run just after Core is initialize and right before
//! Core is closed.
fn addInitAndCloseRunners(init: fn () (void), close: fn () (void)) { }
Enum for selecting subsystems.
Enum for selecting window mode.
Get a new core created with the given flags.
Return the current core.
These functions are run just after Core is initialize and right before Core is closed.
Options at initialization.
Class holding the entire thing together.
Sets callback functions.
Sets callback functions.
Sets callback functions.
Sets callback functions.
Sets callback functions.
Main loop functions, you should expect that this function returns. Best usage is if you in your main function do this "return c.loop();".
Signal the core to quit, will return from loop.
Display a panic message, usually a dialogue box, then calls exit(-1), so this function does not return.
Returns text from the clipboard, should any be in it.