How to use CSMP's rendering pipeline.
FontObject* g_MyFont = NULL;
{
static const char* pFileName = "data/Path/To/My/Image.png";
return g_MyImageId;
{
CSM_LogError(
"MyMod/LoadBmp",
"Failed to aquire an unoccupied surface slot!");
}
{
CSM_LogError(
"MyMod/LoadBmp",
"Failed to load image \"%s\".", pFileName);
}
return g_MyImageId;
}
void MyMod_OnPostDraw()
{
(
(
),
"Hello World!",
);
}
int DataModInterface::OnInit()
{
return 0;
}
void DataModInterface::OnShutdown()
{
if (g_MyFont)
{
g_MyFont = NULL;
}
{
}
delete this;
}
Surface_Ids
List of surface IDs.
Definition: CSMAPI_enums.h:714
@ SURFACE_ID_RENDERER_TEXTURE
Used for drawing directly to the renderer's hardware texture.
Definition: CSMAPI_enums.h:860
@ SURFACE_ID_MAX
Number of surfaces.
Definition: CSMAPI_enums.h:866
static FontObject * GetDefaultFont(unsigned int iMagnification=0)
Get the default font that all GUIs should use.
static void UnloadFont(FontObject *fo)
Unload a font object.
static FontObject * LoadFont(const char *font_name, int font_width, int font_height, bool bDoNotUse=false, VideoTexture *pTexture=NULL, FontManager **resultingManager=NULL, unsigned int iMagnification=0xFFFFFFFF)
Load a font by name & size.
#define TEXT_HEIGHT_2S(font_object, string)
Get the rendered height of a string, automatically divide it by the current global magnification leve...
Definition: CSMAPI_drawing.h:86
#define TEXT_WIDTH_2S(font_object, string)
Get the rendered width of a string, automatically divide it by the current global magnification level...
Definition: CSMAPI_drawing.h:83
CAVESTORY_MOD_API void CSM_SetHook_OnPostDraw(CSM_HOOK_OnPostDrawFunc pFuncPtr)
Hook up a function to make custom code run during a game event.
#define CSM_LogError(pCategory, pFormat,...)
Log an error message to the console & to the log file (if one is open).
Definition: CSMAPI_functions.h:110
#define CSM_RGBA(r, g, b, a)
Combine R, G, B, A into one number.
Definition: CSMAPI_defines.h:79
static bool LoadFileToSurface(const char *pFileName, Surface_Ids iSurfId=SURFACE_ID_MAX, bool bAsync=false, unsigned int iMagnification=0)
Load an image from a file into the selected surface ID.
static GUI_POINT DrawBitmap(GUI_POINT p, GUI_RECT *srcRect, Surface_Ids sid, bool bAbsolutePos=false)
Draw an image.
static void FreeSurfaceID(Surface_Ids sid)
Free a surface ID.
static BOOL SetSurfaceID(Surface_Ids sid)
Set the surface ID that we're editing.
static void DrawLine(GUI_POINT start, GUI_POINT end, unsigned long color, bool bUseMagnification=true)
Draw a line.
static Surface_Ids GetNextFreeSurfaceID(int iSkipCount=0, bool bAsyncUse=false, bool bLockMutex=true)
Get the next free Dynamic Surface ID.
static void DrawClippedText(GUI_POINT p, FontObject *font, const char *text, unsigned long color, int iStringLength=-1, bool bWrap=false, GUI_POINT *pDrawSize=NULL, int iShadowSize=0, unsigned long iShadowColor=0)
Draw clipped text.
Manages points.
Definition: CSMAPI_types.h:546
Definition: CSMAPI_types.h:842