rolmodl
C++ API for the Simple Directmedia Library 2 (SDL2)
Classes | Namespaces | Enumerations | Functions
Base.hpp File Reference
#include "forwarddecl/Base.hpp"
#include "forwarddecl/Event.hpp"
#include "Geom.hpp"
#include "PixelFmt.hpp"

Go to the source code of this file.

Classes

struct  rolmodl::sys::pwr::Status
 System power status snapshot. More...
 
struct  rolmodl::sys::Display
 Display information snapshot. More...
 
struct  rolmodl::sys::DisplayMode
 Display mode parameter plain old struct. More...
 
struct  rolmodl::RGB
 RGB color type. No alpha component. More...
 
struct  rolmodl::RGBA
 RGBA color type. Has an alpha component. More...
 
struct  rolmodl::sdlexception
 Exception type containing an error code and the last SDL error at the moment of creation. More...
 
class  rolmodl::SDLString
 Container for SDL-owned strings that must be freed with SDL_free. More...
 

Namespaces

 rolmodl
 Main namespace.
 
 rolmodl::sys
 System information functions and enums.
 
 rolmodl::sys::cpu
 CPU information functions.
 
 rolmodl::sys::pwr
 Power state functions and enums.
 
 rolmodl::sys::clipboard
 Clipboard functions.
 
 rolmodl::sys::screensaver
 Screensaver functions.
 
 rolmodl::sys::driver
 Video driver functions.
 
 rolmodl::sys::display
 
 rolmodl::sys::display::unsafe
 Unsafe display information functions.
 
 rolmodl::sys::display::mode
 
 rolmodl::sys::display::mode::unsafe
 Unsafe display mode information functions.
 
 rolmodl::detail
 Implementation details.
 

Enumerations

enum  rolmodl::sys::Id {
  AIX, android, BSDI, dreamcast,
  emscripten, freeBSD, haiku, HPUX,
  irix, linux, MiNT, macOSClassic,
  macOSX, NaCl, netBSD, openBSD,
  OS2, OSF, QNXNeutrino, RISCOS,
  solaris, windows, winRT, tvOS,
  iOS, PSP, unknown
}
 OS type enum. More...
 
enum  rolmodl::sys::pwr::State {
  onBattery, noBattery, charging, charged,
  unknown
}
 Indicates battery status a.k.a. the system power state. More...
 

Functions

const char * rolmodl::sys::name () noexcept
 Human-readable OS name. Use rolmodl::sys::id() for OS identification purposes instead of this method. More...
 
Id rolmodl::sys::id () noexcept
 Get id of the OS on which the code is running. May differ from whatever operating system the code was compiled on.
 
unsigned int rolmodl::sys::ram () noexcept
 Get the amount of system RAM in MB. More...
 
unsigned int rolmodl::sys::logicalCores () noexcept
 Get the number of available logical CPU cores. More...
 
unsigned int rolmodl::sys::cpu::l1Size () noexcept
 Get the CPU L1 cache line size in bytes. More...
 
bool rolmodl::sys::cpu::has3DNow () noexcept
 Query whether the CPU supports the 3DNow! extension. More...
 
bool rolmodl::sys::cpu::hasAVX () noexcept
 Query whether the CPU supports the AVX1 extension. More...
 
bool rolmodl::sys::cpu::hasAVX2 () noexcept
 Query whether the CPU supports the AVX2 extension. More...
 
bool rolmodl::sys::cpu::hasAltiVec () noexcept
 Query whether the CPU supports the AltiVec instruction set. More...
 
bool rolmodl::sys::cpu::hasMMX () noexcept
 Query whether the CPU supports the MMX instruction set. More...
 
bool rolmodl::sys::cpu::hasRDTSC () noexcept
 Query whether the CPU supports the RDTSC instruction. More...
 
bool rolmodl::sys::cpu::hasSSE () noexcept
 Query whether the CPU supports the SSE1 extenstion. More...
 
bool rolmodl::sys::cpu::hasSSE2 () noexcept
 Query whether the CPU supports the SSE2 extenstion. More...
 
bool rolmodl::sys::cpu::hasSSE3 () noexcept
 Query whether the CPU supports the SSE3 extenstion. More...
 
bool rolmodl::sys::cpu::hasSSE41 () noexcept
 Query whether the CPU supports the SSE4.1 extenstion. More...
 
bool rolmodl::sys::cpu::hasSSE42 () noexcept
 Query whether the CPU supports the SSE4.2 (Streaming SIMD Extensions) extenstion. More...
 
Status rolmodl::sys::pwr::status () noexcept
 Get a system power status snapshot.
 
bool rolmodl::sys::clipboard::hasText () noexcept
 Query whether thhe clipboard has text contents. More...
 
SDLString rolmodl::sys::clipboard::getText ()
 Get clipboard text contents. More...
 
void rolmodl::sys::clipboard::setText (const char *x)
 Set clipboard text contents. More...
 
void rolmodl::sys::screensaver::enable () noexcept
 Enable system screensaver. More...
 
void rolmodl::sys::screensaver::disable () noexcept
 Disable system screensaver. More...
 
bool rolmodl::sys::screensaver::enabled () noexcept
 Query whether the system screensaver is enabled. More...
 
unsigned int rolmodl::sys::driver::count ()
 Query the amount of available video drivers. More...
 
const char * rolmodl::sys::driver::name (const unsigned int i)
 Get the name of the ith video driver. More...
 
std::optional< const char * > rolmodl::sys::driver::current () noexcept
 Query the current video driver name. More...
 
Display rolmodl::sys::display::unsafe::byIndex (unsigned int i)
 Get display information for the ith display. Unsafe because there is no bounds checking on the index.
 
unsigned int rolmodl::sys::display::unsafe::count ()
 Get the number of displays. Unsafe because the return value is unreliable and may lead to out-of-bounds errors if its cached and used for loop iteration. More...
 
const char * rolmodl::sys::display::unsafe::name (const unsigned int i)
 Get the name of the ith display. Sample output: XF250Q for my Acer XF250Q. Unsafe because there is no bounds checking on the index. More...
 
geom::RectWH rolmodl::sys::display::unsafe::bounds (const unsigned int i)
 Get the resolution of the ith display. Unsafe because there is no bounds checking on the index. More...
 
geom::RectWH rolmodl::sys::display::unsafe::usableBounds (const unsigned int i)
 Get the bounds of the usable space of the ith display. Excludes system decorations such as the menu bar and the dock. Unsafe because there is no bounds checking on the index. More...
 
unsigned int rolmodl::sys::display::mode::unsafe::countForDisplayN (unsigned int n)
 Get the amount of display modes available for the nth display. More...
 
DisplayMode rolmodl::sys::display::mode::unsafe::desktopForDisplayN (unsigned int n)
 Get the display mode used by the system desktop for the nth display. Unsafe because there is no bounds checking on the index. More...
 
DisplayMode rolmodl::sys::display::mode::unsafe::currentForDisplayN (unsigned int n)
 Get the current display mode for the nth display. Unsafe because there is no bounds checking on the index. More...
 
DisplayMode rolmodl::sys::display::mode::unsafe::forDisplayNByIndexI (unsigned int n, unsigned int i)
 Get the ith display mode for the nth display. Unsafe because there is no bounds checking on either index. More...
 
DisplayMode rolmodl::sys::display::mode::unsafe::closestForDisplayN (unsigned int n, const DisplayMode ideal)
 Get the display mode closest to the one specified for the nth display. Unsafe because there is no bounds checking on the index and because it will throw if no display is found. More...
 
int rolmodl::detail::throwOnErr (const int code)
 Throw a rolmodl::sdlexception if code < 0.
 

Detailed Description

Support for base SDL features. rolmodl utilities.

See also
https://wiki.libsdl.org/CategoryPower
https://wiki.libsdl.org/CategoryPlatform
https://wiki.libsdl.org/CategoryCPU
https://wiki.libsdl.org/CategoryVideo
https://wiki.libsdl.org/CategoryClipboard

Definition in file Base.hpp.