CRM64Pro GDK v0.80.0
A free cross-platform game development kit built on top of SDL 3.0
Loading...
Searching...
No Matches
Tutorial 02: System services

Overview

This tutorial extends Tutorial 01 with a Screen render callback, named image resources stored in a CDC archive, a DebugWindow and the built-in Console. The logic remains fixed at 20 updates per second while rendering runs as often as the selected renderer allows.

Final result

CRM64Pro Tutorial 02 final result

Runtime controls

  • Cursor keys: Move the ship image.
  • D: Show or hide the debug window.
  • Grave key: Show or hide the built-in console.
  • Any key or mouse click: Write the input event to the log.
  • Q or ESC: Exit the tutorial.

Prerequisites

  • CRM64Pro GDK installed and configured with a supported C++17 compiler.
  • Tutorial package downloaded and fully extracted, preserving its folder structure.
  • Complete Tutorial 01 or understand its setup and fixed logic loop.
  • Included assets available under bin/Base/: tutorial_bg.png, tutorial_ship.png.
  • Write access to the platform output directory for Tutorial.cdc and the log.

What you will learn

  • Register a Screen render callback.
  • Save named Image resources to a CDC archive.
  • Load Image resources from a CDC archive by name.
  • Create a DebugWindow and watch live variables.
  • Use the built-in Console.
  • Keep fixed-rate logic independent from rendering.

Step by step

1. Configure independent logic and rendering

A render rate of zero lets the Screen render whenever possible. The fixed 20 Hz logic rate still controls movement, keeping gameplay speed independent from the render frame rate.

// Fixed-rate timing.
// Render rate 0 lets the screen render as often as possible. Logic rate controls movement.
static const Sint32 iLogicRate = 20;
static const Sint32 iRenderRate = 0;

2. Register the render callback

Main::update() invokes the callback when a render frame is ready. The callback receives the tutorial state, resolves the current Image resources and draws the frame.

// Screen render callback.
// Main::update() calls this when the screen is ready to render.
static Sint32 renderWrapper(Sint32, void* pObj)
{
TutorialState* pState = static_cast<TutorialState*>(pObj);
if(!pState) return 0;
ImageMgr& mImageMgr = Main::instance().imageMgr();
Image* pBgImage = mImageMgr.get(pState->idBgImage);
Image* pPlayerImage = mImageMgr.get(pState->idPlayerImage);
renderFrame(pBgImage, pPlayerImage, *pState);
return 0;
}
mLog.msg(LL_INFO, " Set render callback ... ");
if(!pScreen->setRenderCallback([&state](Sint32 iMode) { return renderWrapper(iMode, &state); }))
{
logTaskFailed(mLog);
Main::terminate();
return -1;
}
logTaskOk(mLog);

3. Choose the CDC archive

The image save calls create Tutorial.cdc if needed or update its named resources when it already exists. They open the archive for writing and release it after saving, so the tutorial does not remove an existing archive.

#define OUTPUT_CDC OUTPUTDIR"Tutorial.cdc"

4. Save named image resources

Each PNG is loaded as a normal Image, saved to the CDC under a stable resource name, then closed because the file-backed object is no longer needed.

// Load the background from a normal image file.
mLog.msg(LL_INFO, " Load background image: %s ... ", RESOURCE_BG_IMAGE);
Sint32 idBgFile = mC64.imageMgr().loadFromFile(RESOURCE_BG_IMAGE, "tutorialSystemBgFile");
Image* pBgFileImage = mC64.imageMgr().get(idBgFile);
if(idBgFile < 0 || pBgFileImage == nullptr)
{
logTaskFailed(mLog, idBgFile);
Main::terminate();
return -1;
}
logTaskOk(mLog);
// Save the background first.
mLog.msg(LL_INFO, " Save background image to CDC ... ");
if(pBgFileImage->save(OUTPUT_CDC, RESOURCE_BG_CDC_NAME) < 0)
{
logTaskFailed(mLog);
Main::terminate();
return -1;
}
mC64.imageMgr().close(idBgFile);
logTaskOk(mLog);

The ship follows the same load, save and close sequence with RESOURCE_PLAYER_CDC_NAME.

5. Load images by resource name

ImageMgr loads the saved resources from the CDC by archive path and resource name. The order of blocks inside the archive does not matter.

// Load the background by its CDC resource name.
mLog.msg(LL_INFO, " Load background image from CDC ... ");
state.idBgImage = mC64.imageMgr().load(OUTPUT_CDC, RESOURCE_BG_CDC_NAME);
if(state.idBgImage < 0)
{
logTaskFailed(mLog, state.idBgImage);
Main::terminate();
return -1;
}
logTaskOk(mLog);
// Load the ship by its CDC resource name. Load order is not significant.
mLog.msg(LL_INFO, " Load ship image from CDC ... ");
state.idPlayerImage = mC64.imageMgr().load(OUTPUT_CDC, RESOURCE_PLAYER_CDC_NAME);
if(state.idPlayerImage < 0)
{
logTaskFailed(mLog, state.idPlayerImage);
Main::terminate();
return -1;
}
logTaskOk(mLog);

6. Add the debug window

The DebugWindow keeps pointers to the watched values and displays their current contents. The values therefore remain members of TutorialState for the whole main loop.

// The DebugWindow displays live values while the program runs.
mLog.msg(LL_INFO, " Create debug window ... ");
state.idDebugWindow = mC64.guiMgr().create("Debug", CRM64PRO_GUI_DEBUGWINDOW);
DebugWindow* pDebug = mC64.guiMgr().getDebugWindow(state.idDebugWindow);
if(!pDebug)
{
logTaskFailed(mLog, state.idDebugWindow);
Main::terminate();
return -1;
}
pDebug->baseWidget().setPosition(Position(PH_RIGHT, -120), Position(PH_TOP, 10));
pDebug->addWatch("Player X", nullptr, &state.fPlayerX);
pDebug->addWatch("Player Y", nullptr, &state.fPlayerY);
pDebug->addWatch("Mouse X", nullptr, &state.fMouseX);
pDebug->addWatch("Mouse Y", nullptr, &state.fMouseY);
pDebug->addWatch("Logic frames", &state.iLogicFrames);
pDebug->baseWidget().show();
logTaskOk(mLog);
#define CRM64PRO_GUI_DEBUGWINDOW
Definition CRM64Pro.h:9195

7. Use the built-in console

Main creates the default Console. Logging is already routed to it, and the tutorial prints a short ready message when the Console is available.

// Main creates the default Console. Log output is also sent there.
Console* pConsole = mC64.guiMgr().getConsole();
if(pConsole) pConsole->print("Tutorial 02: System ready. Press ` to toggle the console.\n");

8. Run fixed logic after event processing

Main::update() processes input and triggers rendering. Once it returns zero, the program performs one fixed logic update. A quit request exits before that last update.

if(!bRunning) break;
state.fMouseX = mC64.cursorMgr().getX();
state.fMouseY = mC64.cursorMgr().getY();
updateLogic(state, pPlayerImage, 1.0f / static_cast<float>(iLogicRate));

9. Close resources and inspect the CDC

The tutorial closes its GUI and image resources, opens the completed archive read-only to print its information, then closes it and terminates CRM64Pro.

// Close resources owned by this tutorial.
mLog.msg(LL_INFO, "\nCLEANUP\n");
mLog.msg(LL_INFO, " Close debug window ... ");
mC64.guiMgr().close(state.idDebugWindow);
logTaskOk(mLog);
mLog.msg(LL_INFO, " Close images ... ");
mC64.imageMgr().close(0);
logTaskOk(mLog);
mLog.msg(LL_INFO, " Inspect CDC archive ... ");
const Sint32 idCDC = mC64.archiveMgr().load(OUTPUT_CDC);
if(idCDC < 0)
{
logTaskFailed(mLog, idCDC);
Main::terminate();
return -1;
}
logTaskOk(mLog);
mC64.archiveMgr().info();
mLog.msg(LL_INFO, " Close CDC archive ... ");
mC64.archiveMgr().close(idCDC);
logTaskOk(mLog);
Main::terminate();

Complete source

The tutorial source is authoritative. The following listing is included directly from validation/source/Tutorial_02_System.cpp.

/* ----------------------------------------------------------------------
CRM64Pro GDK - Roberto Prieto
Copyright (C) 2013-2026 MegaStorm Systems
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
------------------------------------------------------------------------
Tutorial 02: System
------------------------------------------------------------------------
Overview:
This tutorial extends Tutorial 01 Basic with a render callback, named CDC
resources, the debug window and the built-in console.
Key concepts:
- Use a Screen render callback.
- Save named Image resources to a CDC file.
- Load Image resources from a CDC file by name.
- Create a DebugWindow and add watched variables.
- Use the built-in Console.
- Keep the fixed logic update from Tutorial 01 Basic.
Controls:
- Cursor Keys: Move the ship image.
- D: Toggle debug window.
- Grave: Toggle console.
- Any Key/Mouse: Logs events.
- Q / ESC: Quit.
Loop order:
- Process input events.
- Run one fixed logic update.
- Let Main::update() call the screen render callback.
------------------------------------------------------------------------ */
#include "CRM64Pro.h"
#include "RunParameter.h"
using namespace CRM64Pro;
#define BASEDIR "Base/"
#ifdef CRM64PRO_PLATFORM_WINDOWS
#define OUTPUTDIR "Win64/"
#elif defined(CRM64PRO_PLATFORM_LINUX)
#define OUTPUTDIR "Linux/"
#elif defined(CRM64PRO_PLATFORM_MACOS)
#define OUTPUTDIR "macOS/"
#endif
#define RESOURCE_BG_IMAGE BASEDIR"tutorial_bg.png"
#define RESOURCE_PLAYER_IMAGE BASEDIR"tutorial_ship.png"
#define RESOURCE_BG_CDC_NAME "Tutorial_bg"
#define RESOURCE_PLAYER_CDC_NAME "Tutorial_ship"
#define OUTPUT_CDC OUTPUTDIR"Tutorial.cdc"
// Fixed-rate timing.
// Render rate 0 lets the screen render as often as possible. Logic rate controls movement.
static const Sint32 iLogicRate = 20;
static const Sint32 iRenderRate = 0;
// Window size and movement speed.
static const Sint32 iScreenW = 960;
static const Sint32 iScreenH = 540;
static const float fMoveSpeed = 220.0f;
// Values changed while the tutorial runs.
struct TutorialState
{
Sint32 idBgImage = -1;
Sint32 idPlayerImage = -1;
Sint32 idDebugWindow = -1;
float fPlayerX = 386.0f;
float fPlayerY = 186.0f;
float fMouseX = 0.0f;
float fMouseY = 0.0f;
Sint32 iLogicFrames = 0;
bool bMoveLeft = false;
bool bMoveRight = false;
bool bMoveUp = false;
bool bMoveDown = false;
};
// Keep a value inside the given range.
static float clampFloat(float fValue, float fMin, float fMax)
{
if(fValue < fMin) return fMin;
if(fValue > fMax) return fMax;
return fValue;
}
// Helper functions used by the setup log messages.
static void logTaskOk(Log& mLog)
{
mLog.msg(LL_DEBUG, "OK\n");
}
// Record a failed tutorial task.
static void logTaskFailed(Log& mLog, Sint32 iCode)
{
mLog.msg(LL_ERROR, "FAILED (Code %d)\n", iCode);
}
// Record a failed tutorial task.
static void logTaskFailed(Log& mLog)
{
mLog.msg(LL_ERROR, "FAILED\n");
}
// Move the ship image one fixed logic step.
static void updateLogic(TutorialState& rState, Image* pPlayerImage, float fDeltaTime)
{
if(!pPlayerImage) return;
float fDX = 0.0f;
float fDY = 0.0f;
if(rState.bMoveLeft) fDX -= fMoveSpeed * fDeltaTime;
if(rState.bMoveRight) fDX += fMoveSpeed * fDeltaTime;
if(rState.bMoveUp) fDY -= fMoveSpeed * fDeltaTime;
if(rState.bMoveDown) fDY += fMoveSpeed * fDeltaTime;
const float fMaxX = static_cast<float>(iScreenW - pPlayerImage->getWidth());
const float fMaxY = static_cast<float>(iScreenH - pPlayerImage->getHeight());
rState.fPlayerX = clampFloat(rState.fPlayerX + fDX, 0.0f, fMaxX);
rState.fPlayerY = clampFloat(rState.fPlayerY + fDY, 0.0f, fMaxY);
rState.iLogicFrames++;
}
// Draw the current frame.
static void renderFrame(Image* pBgImage, Image* pPlayerImage, const TutorialState& rState)
{
if(pBgImage) pBgImage->render();
if(pPlayerImage)
{
SDL_FRect rDst = {
rState.fPlayerX,
rState.fPlayerY,
static_cast<float>(pPlayerImage->getWidth()),
static_cast<float>(pPlayerImage->getHeight())
};
pPlayerImage->render(0, nullptr, &rDst);
}
}
// Screen render callback.
// Main::update() calls this when the screen is ready to render.
static Sint32 renderWrapper(Sint32, void* pObj)
{
TutorialState* pState = static_cast<TutorialState*>(pObj);
if(!pState) return 0;
ImageMgr& mImageMgr = Main::instance().imageMgr();
Image* pBgImage = mImageMgr.get(pState->idBgImage);
Image* pPlayerImage = mImageMgr.get(pState->idPlayerImage);
renderFrame(pBgImage, pPlayerImage, *pState);
return 0;
}
// Show or hide the debug window.
static void toggleDebugWindow(DebugWindow* pDebug)
{
if(!pDebug) return;
if(pDebug->baseWidget().status() == GS_SHOWN) pDebug->baseWidget().hide();
else pDebug->baseWidget().show();
}
// Run the tutorial application and release its resources.
int main(int argc, char* argv[])
{
if(!runParameterReadRender(argc, argv, eRenderer)) return 1;
// Start CRM64Pro memory tracking before creating engine resources.
// atexit() releases memory tracking data when the program exits.
atexit(CMem::destroy);
// Main gives access to the CRM64Pro managers.
Main& mC64 = Main::instance();
Log& mLog = *mC64.logMgr().get();
TutorialState state;
// Write log output to stdout and to a file under validation/bin.
mLog.init("Tutorial_02_System", LL_DEBUG, LM_FILE | LM_STDOUT, OUTPUTDIR"Tutorial_02_System.log");
mLog.msg(LL_INFO, "\nSETUP: screen and timing\n");
// Initialize the timer before calling Main::update().
// setRate() receives render frames per second, then logic frames per second.
mLog.msg(LL_INFO, " Initialize timer ... ");
if(!mC64.timer().init())
{
logTaskFailed(mLog);
return -1;
}
logTaskOk(mLog);
mLog.msg(LL_INFO, " Set frame rates (render=%d, logic=%d) ... ", iRenderRate, iLogicRate);
if(!mC64.timer().setRate(iRenderRate, iLogicRate))
{
logTaskFailed(mLog);
return -1;
}
logTaskOk(mLog);
// Add a 1 ms idle delay inside Main::update().
// Configure and show the default screen.
Screen* pScreen = mC64.configMgr().get();
pScreen->setSize(iScreenW, iScreenH);
pScreen->setDriver(eRenderer);
pScreen->setTitle("CRM64Pro - Tutorial 02: System");
mLog.msg(LL_INFO, " Create screen (%dx%d) ... ", iScreenW, iScreenH);
if(pScreen->show() < 0)
{
mLog.msg(LL_CRITICAL, "FAILED\n");
return -1;
}
logTaskOk(mLog);
mLog.msg(LL_INFO, " Set render callback ... ");
if(!pScreen->setRenderCallback([&state](Sint32 iMode) { return renderWrapper(iMode, &state); }))
{
logTaskFailed(mLog);
return -1;
}
logTaskOk(mLog);
mLog.msg(LL_INFO, "\nRESOURCES: file images and CDC\n");
// Load the background from a normal image file.
mLog.msg(LL_INFO, " Load background image: %s ... ", RESOURCE_BG_IMAGE);
Sint32 idBgFile = mC64.imageMgr().loadFromFile(RESOURCE_BG_IMAGE, "tutorialSystemBgFile");
Image* pBgFileImage = mC64.imageMgr().get(idBgFile);
if(idBgFile < 0 || pBgFileImage == nullptr)
{
logTaskFailed(mLog, idBgFile);
return -1;
}
logTaskOk(mLog);
// Save the background first.
mLog.msg(LL_INFO, " Save background image to CDC ... ");
if(pBgFileImage->save(OUTPUT_CDC, RESOURCE_BG_CDC_NAME) < 0)
{
logTaskFailed(mLog);
return -1;
}
mC64.imageMgr().close(idBgFile);
logTaskOk(mLog);
// Load the ship from a normal image file.
mLog.msg(LL_INFO, " Load ship image: %s ... ", RESOURCE_PLAYER_IMAGE);
Sint32 idPlayerFile = mC64.imageMgr().loadFromFile(RESOURCE_PLAYER_IMAGE, "tutorialSystemPlayerFile");
Image* pPlayerFileImage = mC64.imageMgr().get(idPlayerFile);
if(idPlayerFile < 0 || pPlayerFileImage == nullptr)
{
logTaskFailed(mLog, idPlayerFile);
return -1;
}
logTaskOk(mLog);
// Save the ship second.
mLog.msg(LL_INFO, " Save ship image to CDC ... ");
if(pPlayerFileImage->save(OUTPUT_CDC, RESOURCE_PLAYER_CDC_NAME) < 0)
{
logTaskFailed(mLog);
return -1;
}
mC64.imageMgr().close(idPlayerFile);
logTaskOk(mLog);
// Load the background by its CDC resource name.
mLog.msg(LL_INFO, " Load background image from CDC ... ");
state.idBgImage = mC64.imageMgr().load(OUTPUT_CDC, RESOURCE_BG_CDC_NAME);
if(state.idBgImage < 0)
{
logTaskFailed(mLog, state.idBgImage);
return -1;
}
logTaskOk(mLog);
// Load the ship by its CDC resource name. Load order is not significant.
mLog.msg(LL_INFO, " Load ship image from CDC ... ");
state.idPlayerImage = mC64.imageMgr().load(OUTPUT_CDC, RESOURCE_PLAYER_CDC_NAME);
if(state.idPlayerImage < 0)
{
logTaskFailed(mLog, state.idPlayerImage);
return -1;
}
logTaskOk(mLog);
Image* pPlayerImage = mC64.imageMgr().get(state.idPlayerImage);
if(pPlayerImage == nullptr)
{
logTaskFailed(mLog);
return -1;
}
mLog.msg(LL_INFO, "\nTOOLS: debug window and console\n");
// The DebugWindow displays live values while the program runs.
mLog.msg(LL_INFO, " Create debug window ... ");
state.idDebugWindow = mC64.guiMgr().create("Debug", CRM64PRO_GUI_DEBUGWINDOW);
DebugWindow* pDebug = mC64.guiMgr().getDebugWindow(state.idDebugWindow);
if(!pDebug)
{
logTaskFailed(mLog, state.idDebugWindow);
return -1;
}
pDebug->addWatch("Player X", nullptr, &state.fPlayerX);
pDebug->addWatch("Player Y", nullptr, &state.fPlayerY);
pDebug->addWatch("Mouse X", nullptr, &state.fMouseX);
pDebug->addWatch("Mouse Y", nullptr, &state.fMouseY);
pDebug->addWatch("Logic frames", &state.iLogicFrames);
pDebug->baseWidget().show();
logTaskOk(mLog);
// Main creates the default Console. Log output is also sent there.
Console* pConsole = mC64.guiMgr().getConsole();
if(pConsole) pConsole->print("Tutorial 02: System ready. Press ` to toggle the console.\n");
mLog.msg(LL_INFO, "\nCONTROLS\n");
mLog.msg(LL_INFO, " [Q] / [ESC] Quit\n");
mLog.msg(LL_INFO, " [Arrow Keys] Move the ship image\n");
mLog.msg(LL_INFO, " [D] Toggle debug window\n");
mLog.msg(LL_INFO, " [`] Toggle console\n");
mLog.msg(LL_INFO, " Any key or mouse button logs the input event\n");
mLog.msg(LL_INFO, "\nRUNNING\n");
SDL_Event event;
bool bRunning = true;
while(bRunning)
{
// Main::update() processes input, runs internal GUI logic and calls the
// screen render callback when a render frame is ready.
while(mC64.update(&event))
{
if(event.type == SDL_EVENT_QUIT)
{
bRunning = false;
}
else if(event.type == SDL_EVENT_KEY_DOWN)
{
// SDL3 stores the key value in event.key.key.
mLog.msg(LL_INFO, " Key pressed: %s (%d)\n", SDL_GetKeyName(event.key.key), event.key.key);
if(event.key.key == SDLK_Q || event.key.key == SDLK_ESCAPE)
{
bRunning = false;
}
else if(event.key.key == SDLK_LEFT)
{
state.bMoveLeft = true;
}
else if(event.key.key == SDLK_RIGHT)
{
state.bMoveRight = true;
}
else if(event.key.key == SDLK_UP)
{
state.bMoveUp = true;
}
else if(event.key.key == SDLK_DOWN)
{
state.bMoveDown = true;
}
else if(event.key.key == SDLK_D)
{
toggleDebugWindow(pDebug);
}
}
else if(event.type == SDL_EVENT_KEY_UP)
{
if(event.key.key == SDLK_LEFT) state.bMoveLeft = false;
else if(event.key.key == SDLK_RIGHT) state.bMoveRight = false;
else if(event.key.key == SDLK_UP) state.bMoveUp = false;
else if(event.key.key == SDLK_DOWN) state.bMoveDown = false;
}
else if(event.type == SDL_EVENT_MOUSE_BUTTON_DOWN)
{
mLog.msg(LL_INFO, " Mouse clicked: button %d at %d, %d\n", event.button.button, (Sint32)event.button.x, (Sint32)event.button.y);
}
}
if(!bRunning) break;
state.fMouseX = mC64.cursorMgr().getX();
state.fMouseY = mC64.cursorMgr().getY();
updateLogic(state, pPlayerImage, 1.0f / static_cast<float>(iLogicRate));
}
// Close resources owned by this tutorial.
mLog.msg(LL_INFO, "\nCLEANUP\n");
mLog.msg(LL_INFO, " Close debug window ... ");
mC64.guiMgr().close(state.idDebugWindow);
logTaskOk(mLog);
mLog.msg(LL_INFO, " Close images ... ");
mC64.imageMgr().close(0);
logTaskOk(mLog);
mLog.msg(LL_INFO, " Inspect CDC archive ... ");
const Sint32 idCDC = mC64.archiveMgr().load(OUTPUT_CDC);
if(idCDC < 0)
{
logTaskFailed(mLog, idCDC);
return -1;
}
logTaskOk(mLog);
mC64.archiveMgr().info();
mLog.msg(LL_INFO, " Close CDC archive ... ");
mC64.archiveMgr().close(idCDC);
logTaskOk(mLog);
return 0;
}
Sint32 close(Sint32 idCDC) override
Close and destroy a CDC object.
Definition CoreArchive.cpp:2476
Sint32 load(const string &sFile, eArchiveOpenMode eMode=AOM_READ_ONLY, const Uint8 *pKey=nullptr, Uint32 iKeySize=0)
Load a CDC file.
Definition CoreArchive.cpp:2630
bool info(Sint32 iMode=0) override
Request Archive Manager information.
Definition CoreArchive.cpp:2420
Screen * get(Sint32 idScreen=0)
Get a pointer to the screen using its handle.
Definition CoreConfig.cpp:1497
void setMTFriendly(Uint8 iDelayMS)
Set the multithread-friendly scheduler yield.
Definition CoreConfig.cpp:1183
Console Object class.
Definition CRM64Pro.h:9678
float getY() const
Get the mouse cursor Y position.
Definition GraphicsCursor.cpp:1041
float getX() const
Get the mouse cursor X position.
Definition GraphicsCursor.cpp:1035
DebugWindow Object class.
Definition CRM64Pro.h:9810
Image Object class.
Definition CRM64Pro.h:3356
Sint32 getHeight() const
Get the image height.
Definition GraphicsImage.cpp:1839
Sint32 getWidth() const
Get the image width.
Definition GraphicsImage.cpp:1833
Sint32 render(Sint32 idRes=0, SDL_FRect *pSrc=nullptr, SDL_FRect *pDst=nullptr)
Render the image.
Definition GraphicsImage.cpp:1575
Sint32 save(const string &sCDCFile, const string &sResourceName="")
Save the image to a CDC file.
Definition GraphicsImage.cpp:1888
Image Manager class.
Definition CRM64Pro.h:3570
Image * get(Sint32 idImg)
Get a pointer to the image using its handle.
Definition GraphicsImage.cpp:2279
Sint32 loadFromFile(const string &sFile, const string &sName="")
Load an image from an external file (BMP, PNG, JPG, PCX, TGA or WebP formats).
Definition GraphicsImage.cpp:2434
Sint32 load(const string &sCDCFile, const string &sName)
Load an image stored in a CDC file.
Definition GraphicsImage.cpp:2476
Sint32 close(Sint32 idImg) override
Close and destroy an image.
Definition GraphicsImage.cpp:2178
Log Object class.
Definition CRM64Pro.h:771
CRM64Pro GDK Main class.
Definition CRM64Pro.h:502
Screen Object class.
Definition CRM64Pro.h:1055
Sint32 show()
Show the screen.
Definition CoreConfig.cpp:362
Sint32 setDriver(eConfigRendererDriver eCRD)
Set the renderer driver.
Definition CoreConfig.cpp:454
bool setRenderCallback(RenderCallback fnCallback)
Set a callback function for rendering graphics at Render Frame Rate.
Definition CoreConfig.cpp:765
Sint32 setSize(Sint32 iWidth, Sint32 iHeight)
Set the size of the screen.
Definition CoreConfig.cpp:526
bool setTitle(const string &sName)
Set the title.
Definition CoreConfig.cpp:674
void setStatsLevel(eMemStatsLevel eMSL)
Set the memory stats gathering level.
Definition CMemoryManager.cpp:618
void destroy()
Releases the internal heap and displays final stats.
Definition CMemoryManager.cpp:954
@ MSL_NORMAL
Collect allocations per module (CRM64Pro and user). Default for debug builds.
Definition CRM64Pro.h:386
eConfigRendererDriver
Screen renderer drivers.
Definition CRM64Pro.h:1013
@ CRD_SOFTWARE
Screen::setDriver(): software renderer driver. Slow but works on all platforms.
Definition CRM64Pro.h:1015
Sint32 create(const string &sName, Uint32 iType=CRM64PRO_GUI_PANEL) override
Creates a new GUI object.
Definition GUI.cpp:1051
Sint32 addWatch(const string &sName, Sint32 *iIntegerVar, float *fFloatVar=nullptr)
Add a watch.
Definition GUIDebugWindow.cpp:275
Widget & baseWidget()
Get the reference to base Widget for this object.
Definition GUIDebugWindow.cpp:269
Sint32 print(const char *format,...)
Print a formatted message to the console.
Definition GUIConsole.cpp:403
Console * getConsole(Sint32 idGUI=CRM64PRO_GUI_CONSOLE)
Get a pointer to a Console using its handle.
Definition GUI.cpp:1366
DebugWindow * getDebugWindow(Sint32 idGUI)
Get a pointer to a DebugWindow using its handle.
Definition GUI.cpp:1375
Sint32 close(Sint32 idGUI) override
Close and destroy a GUI object.
Definition GUI.cpp:1168
eGeneralStatus status() const
Get the widget status.
Definition GUIWidget.cpp:1772
bool hide()
Hide a widget.
Definition GUIWidget.cpp:1729
bool show()
Show a widget.
Definition GUIWidget.cpp:1671
Sint32 setPosition(const Position &rPosX=Position(PH_CENTER), const Position &rPosY=Position(PH_CENTER))
Set the position.
Definition GUIWidget.cpp:1923
Log * get(Sint32 idLog=0)
Get a pointer to the log object.
Definition CoreLog.cpp:921
bool init(const string &sAppname, eLogLevel eLL, eLogMode eLM, const string &sFilename="", const string &sAuthor="", const string &sEmail="", const string &sWeb="")
Initialize the log object.
Definition CoreLog.cpp:338
@ LM_FILE
Log output mode for the 'lm' parameter in CRM64Pro::Log::init(). Output to a file and overwrite exist...
Definition CRM64Pro.h:748
@ LM_STDOUT
Log output mode for the 'lm' parameter in CRM64Pro::Log::init(). Output to standard output (stdout).
Definition CRM64Pro.h:750
@ LL_INFO
Runtime events (startup/shutdown). Messages without timestamp.
Definition CRM64Pro.h:764
@ LL_DEBUG
Detailed information for flow control.
Definition CRM64Pro.h:765
@ LL_CRITICAL
Fatal errors, application crash, or assertions.
Definition CRM64Pro.h:761
@ LL_ERROR
Runtime errors that do not require immediate termination.
Definition CRM64Pro.h:762
GUIMgr & guiMgr()
Get reference to GUI Manager.
Definition CoreMain.cpp:808
Timer & timer()
Get reference to Timer module.
Definition CoreMain.cpp:730
Sint32 update(SDL_Event *evUser=nullptr)
Manage the GDK update cycle with a fixed virtual logic frame rate.
Definition CoreMain.cpp:451
ImageMgr & imageMgr()
Get reference to Image Manager.
Definition CoreMain.cpp:754
CursorMgr & cursorMgr()
Get reference to Cursor Manager.
Definition CoreMain.cpp:760
static void terminate()
Main explicit destructor.
Definition CoreMain.cpp:266
static Main & instance()
Access the Main singleton.
Definition CoreMain.cpp:252
LogMgr & logMgr()
Get reference to Log Manager.
Definition CoreMain.cpp:724
ArchiveMgr & archiveMgr()
Get reference to Archive Manager.
Definition CoreMain.cpp:736
ConfigMgr & configMgr()
Get reference to Config Manager.
Definition CoreMain.cpp:712
@ GS_SHOWN
General status: enabled and shown.
Definition CRM64Pro.h:300
@ PH_RIGHT
Widget/Font: right with optional offset. Scene: align to map right/end (MapWidth - ViewportWidth)....
Definition CRM64Pro.h:340
@ PH_TOP
Widget/Font: top with optional offset. Scene: align to map top/begin (0.0). Valid for Y axis.
Definition CRM64Pro.h:337
bool init(eTimerState eState=TS_INIT)
Initialize the timer system.
Definition CoreTimer.cpp:543
bool setRate(Uint16 iR, Uint16 iL)
Set preferred Render and Logic Frame Rate.
Definition CoreTimer.cpp:556
CRM64Pro GDK.
Definition AudioTrack.cpp:36
Absolute coordinate or helper-relative position used by layout APIs.
Definition CRM64Pro.h:346

Navigation

Previous: Tutorial 01 - Basic application setup

Back to the tutorials index

The next tutorial opens the configuration screen and stores its settings in the shared CDC archive.

Continue with Tutorial 03: Configuration