Reflex::System
The System module abstracts all platform-specific functionality — time, filesystem, input, networking, windowing, and rendering. You typically use it indirectly through higher-level modules, but it's available for low-level control.
Platform Utilities
The System module abstracts all platform-specific functionality. You typically use it indirectly through higher-level modules (GLX, File), but it's available for low-level control.
Time
Float64 GetElapsedTime(); // High-resolution elapsed time (seconds)UInt64 GetTime(); // System timeSystem Info
UInt32 GetNumProcessor(); // CPU core countCString GetOperatingSystemVersion(); // e.g. "Windows 10.0.19045"UInt64 GetSystemID(); // Unique machine identifierPaths
WString GetPath(Path path_id); // Get system pathPath Constants
| Constant | Description |
|---|---|
| kPathTemp | Temp directory |
| kPathDesktop | User desktop |
| kPathApplicationData | App data (roaming) |
| kPathUserData | User data directory |
| kPathUserDocuments | User documents |
Filesystem
bool Exists(const WString& path);bool IsDirectory(const WString& path);bool MakeDirectory(const WString& path);bool Rename(const WString& from, const WString& to);bool Delete(const WString& path);bool Launch(const WString& path); // Open file/URL with default handlerEnumerations
System-level enumerations for input handling, cursors, and HTTP responses.
MouseCursor
| Constant | Description |
|---|---|
| kMouseCursorInvisible | Hidden cursor |
| kMouseCursorArrow | Default arrow |
| kMouseCursorWait | Hourglass / spinner |
| kMouseCursorMove | Four-way move |
| kMouseCursorLeftRight | Horizontal resize |
| kMouseCursorTopBottom | Vertical resize |
| kMouseCursorTopLeftBottomRight | Diagonal resize (↘) |
| kMouseCursorBottomLeftTopRight | Diagonal resize (↗) |
| kMouseCursorPointer | Hand / link |
| kMouseCursorDrag | Drag handle |
| kMouseCursorText | I-beam |
| kMouseCursorBlock | Not-allowed |
| kMouseCursorZoom | Magnifying glass |
KeyCode
kKeyCodeNull, kKeyCodeF1 ... kKeyCodeF12kKeyCodeTab, kKeyCodeEnter, kKeyCodeEscape, kKeyCodeSpacekKeyCodeBackspace, kKeyCodeInsert, kKeyCodeDeletekKeyCodeHome, kKeyCodeEnd, kKeyCodePageUp, kKeyCodePageDownkKeyCodeUp, kKeyCodeDown, kKeyCodeLeft, kKeyCodeRightkKeyCode0 ... kKeyCode9, kKeyCodeA ... kKeyCodeZkKeyCodeMinus, kKeyCodePlus, kKeyCodeSlashkKeyCodeBracketOpen, kKeyCodeBracketClosekKeyCodeNumericDivide/Multiply/Minus/PlusModifierKeys
| Constant | Description |
|---|---|
| kModifierKeyShift | Shift key |
| kModifierKeyCtrl | Control key |
| kModifierKeyAlt | Alt / Option key |
| kModifierKeySystem | Cmd on macOS, Win on Windows |
HttpConnection::Response
| Constant | Description |
|---|---|
| kResponseAborted | Request was aborted |
| kResponseNoConnection | No connection available |
| kResponseOK | 200 OK |
| kResponsePartialContent | 206 Partial Content |
| kResponseMovedPermanently | 301 Moved Permanently |
| kResponseFound | 302 Found |
| kResponseBadRequest | 400 Bad Request |
| kResponseUnauthorized | 401 Unauthorized |
| kResponseForbidden | 403 Forbidden |
| kResponseNotFound | 404 Not Found |
| kResponseInternalServerError | 500 Internal Server Error |
| kResponseServiceUnavailable | 503 Service Unavailable |
Type Aliases
Convenience aliases for commonly used parameterised types, plus the Colour type.
Geometry Aliases
| Alias | Expands To |
|---|---|
| fPoint | Point<Float32> |
| fSize | Size<Float32> |
| fRect | Rect<Float32> |
| ColourPoint | Tuple<Point<Float32>, Colour> |
Colour
All colour components are 0.0–1.0 floating point.
Float32 Colour::r;Float32 Colour::g;Float32 Colour::b;Float32 Colour::a;System Classes
Low-level system classes that all inherit from Object. These handle file I/O, networking, windowing, rendering, threading, and more.
Overview
| Class | Inherits | Purpose |
|---|---|---|
| FileHandle | Object | Low-level file I/O handle |
| HttpConnection | Object | HTTP client |
| Window | Object | Native window |
| Renderer | Object | GPU renderer |
| Renderer::Canvas | Object | Drawing surface |
| Renderer::Graphic | Object | Renderable graphic |
| Thread | Task | OS thread |
| Process | Thread | Child process |
| Task | Object | Base for async operations |
| DirectoryIterator | Object | Enumerate directory contents |
| DiskIterator | Object | Enumerate disk volumes |
| DynamicLibrary | Object | Load shared libraries (.dll/.dylib/.so) |
FileHandle
Low-level file I/O. Most applications will use higher-level file utilities, but FileHandle is available when you need direct control.
bool FileHandle::Status(); // Is handle valid?bool FileHandle::IsWriteable();UInt64 FileHandle::GetSize();void FileHandle::SetPosition(UInt64 position);UInt64 FileHandle::GetPosition();UInt32 FileHandle::Read(void* bytes, UInt32 buffer_capacity);UInt32 FileHandle::Write(const void* bytes, UInt32 size);HttpConnection
HTTP client for making network requests.
void HttpConnection::SetTimeout(Float32 connection, Float32 transfer);
HttpConnection::Response HttpConnection::Request( const CString::View& method, const CString::View& resource, const ArrayView<Pair<Array<char>, Array<char>>>& headers, const ArrayView<UInt8>& body, const HttpConnection::ReceiveHeaderFn& receive_header, const HttpConnection::ReceiveDataFn& receive_data);