Cavestory Mod API
Classes | Macros | Typedefs | Functions | Variables
CSMAPI_drawing.h File Reference
#include <List.h>
#include <CSMAPI_begincode.h>
#include <CSMAPI_endcode.h>

Go to the source code of this file.

Classes

struct  Mouse
 
struct  SpecialTextNode
 A node for SpecialTextCache. More...
 
struct  SpecialTextCache
 A cache object to store parsed special text. More...
 
struct  CacheSurface
 Rendering pipeline for Cavestory Multiplayer. More...
 

Macros

#define FONT_OBJECT_SIZE   1040
 Do not change.
 
#define TEXT_SIZE(font_object, string, ptr_x, ptr_y)   GetTextSize(font_object, string, strlen(string), &ptr_x, &ptr_y); ptr_x /= magnification; ptr_y /= magnification;
 Get the rendered size of a string.
 
#define TEXT_SIZE_2(font_object, string, string_length, ptr_x, ptr_y)   GetTextSize(font_object, string, string_length, &ptr_x, &ptr_y); ptr_x /= magnification; ptr_y /= magnification;
 Get the rendered size of a string and automatically divide it by the current global magnification level.
 
#define TEXT_WIDTH(font_object, string)   (GetTextWidth(font_object, string) / magnification)
 Get the rendered width of a string.
 
#define TEXT_HEIGHT(font_object, string)   (GetTextHeight(font_object, string) / magnification)
 Get the rendered height of a string.
 
#define TEXT_WIDTH_2(font_object, string, string_length)   (GetTextWidth(font_object, string, string_length) / magnification)
 Get the rendered width of a string and automatically divide it by the current global magnification level.
 
#define TEXT_HEIGHT_2(font_object, string, string_length)   (GetTextHeight(font_object, string, string_length) / magnification)
 Get the rendered height of a string and automatically divide it by the current global magnification level.
 
#define TEXT_WIDTH_2S(font_object, string)   (GetTextWidth(font_object, string, strlen(string)) / magnification)
 Get the rendered width of a string, automatically divide it by the current global magnification level, and automatically calculate the string length.
 
#define TEXT_HEIGHT_2S(font_object, string)   (GetTextHeight(font_object, string, strlen(string)) / magnification)
 Get the rendered height of a string, automatically divide it by the current global magnification level, and automatically calculate the string length.
 
#define FONT_ASCII_HEIGHT(font_object)   (GetTextHeight(font_object, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") / magnification)
 Get the base height for a font.
 
#define UI_TEXT_SIZE(font_object, string, ptr_x, ptr_y)   GetTextSize(font_object, string, strlen(string), &ptr_x, &ptr_y); ptr_x /= CSM_GetUIMagnificationLevel(); ptr_y /= CSM_GetUIMagnificationLevel();
 Get the rendered size of a string.
 
#define UI_TEXT_SIZE_2(font_object, string, string_length, ptr_x, ptr_y)   GetTextSize(font_object, string, string_length, &ptr_x, &ptr_y); ptr_x /= CSM_GetUIMagnificationLevel(); ptr_y /= CSM_GetUIMagnificationLevel();
 Get the rendered size of a string and automatically divide it by the current global magnification level.
 
#define UI_TEXT_WIDTH(font_object, string)   (GetTextWidth(font_object, string) / CSM_GetUIMagnificationLevel())
 Get the rendered width of a string.
 
#define UI_TEXT_HEIGHT(font_object, string)   (GetTextHeight(font_object, string) / CSM_GetUIMagnificationLevel())
 Get the rendered height of a string.
 
#define UI_TEXT_WIDTH_2(font_object, string, string_length)   (GetTextWidth(font_object, string, string_length) / CSM_GetUIMagnificationLevel())
 Get the rendered width of a string and automatically divide it by the current global magnification level.
 
#define UI_TEXT_HEIGHT_2(font_object, string, string_length)   (GetTextHeight(font_object, string, string_length) / CSM_GetUIMagnificationLevel())
 Get the rendered height of a string and automatically divide it by the current global magnification level.
 
#define UI_TEXT_WIDTH_2S(font_object, string)   (GetTextWidth(font_object, string, strlen(string)) / CSM_GetUIMagnificationLevel())
 Get the rendered width of a string, automatically divide it by the current global magnification level, and automatically calculate the string length.
 
#define UI_TEXT_HEIGHT_2S(font_object, string)   (GetTextHeight(font_object, string, strlen(string)) / CSM_GetUIMagnificationLevel())
 Get the rendered height of a string, automatically divide it by the current global magnification level, and automatically calculate the string length.
 
#define UI_FONT_ASCII_HEIGHT(font_object)   (GetTextHeight(font_object, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") / CSM_GetUIMagnificationLevel())
 Get the base height for a font.
 
#define CUSTOMMAG_TEXT_SIZE(INPUT_MAG, font_object, string, ptr_x, ptr_y)   GetTextSize(font_object, string, strlen(string), &ptr_x, &ptr_y); ptr_x /= INPUT_MAG; ptr_y /= INPUT_MAG;
 Get the rendered size of a string.
 
#define CUSTOMMAG_TEXT_SIZE_2(INPUT_MAG, font_object, string, string_length, ptr_x, ptr_y)   GetTextSize(font_object, string, string_length, &ptr_x, &ptr_y); ptr_x /= INPUT_MAG; ptr_y /= INPUT_MAG;
 Get the rendered size of a string and automatically divide it by the current global magnification level.
 
#define CUSTOMMAG_TEXT_WIDTH(INPUT_MAG, font_object, string)   (GetTextWidth(font_object, string) / INPUT_MAG)
 Get the rendered width of a string.
 
#define CUSTOMMAG_TEXT_HEIGHT(INPUT_MAG, font_object, string)   (GetTextHeight(font_object, string) / INPUT_MAG)
 Get the rendered height of a string.
 
#define CUSTOMMAG_TEXT_WIDTH_2(INPUT_MAG, font_object, string, string_length)   (GetTextWidth(font_object, string, string_length) / INPUT_MAG)
 Get the rendered width of a string and automatically divide it by the current global magnification level.
 
#define CUSTOMMAG_TEXT_HEIGHT_2(INPUT_MAG, font_object, string, string_length)   (GetTextHeight(font_object, string, string_length) / INPUT_MAG)
 Get the rendered height of a string and automatically divide it by the current global magnification level.
 
#define CUSTOMMAG_TEXT_WIDTH_2S(INPUT_MAG, font_object, string)   (GetTextWidth(font_object, string, strlen(string)) / INPUT_MAG)
 Get the rendered width of a string, automatically divide it by the current global magnification level, and automatically calculate the string length.
 
#define CUSTOMMAG_TEXT_HEIGHT_2S(INPUT_MAG, font_object, string)   (GetTextHeight(font_object, string, strlen(string)) / INPUT_MAG)
 Get the rendered height of a string, automatically divide it by the current global magnification level, and automatically calculate the string length.
 
#define CUSTOMMAG_FONT_ASCII_HEIGHT(INPUT_MAG, font_object)   (GetTextHeight(font_object, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") / INPUT_MAG)
 Get the base height for a font.
 

Typedefs

typedef struct FontObject FontObject
 

Functions

CAVESTORY_MOD_API int CSM_GetUIMagnificationLevel ()
 Get the current UI magnification. More...
 
CAVESTORY_MOD_API int CSM_GetChatMagnificationLevel ()
 Get the current chat magnification. More...
 
CAVESTORY_MOD_API void SetFontCharacterWhitelist (const unsigned char *pWhitelist)
 Set a whitelist for the rendering system. More...
 
CAVESTORY_MOD_API void SetFontWhitelistEnabled (bool bEnabled)
 Set whether the whitelist is active or not. More...
 
CAVESTORY_MOD_API const unsigned char * GetFontCharacterWhitelist ()
 Get the current font whitelist. More...
 
CAVESTORY_MOD_API FontObject * LoadFontFromFile (const char *pFileName, unsigned int cell_width, unsigned int cell_height, VideoTexture *pTexture=NULL, FontManager *pManager=NULL)
 Load a font object from a file. More...
 
CAVESTORY_MOD_API void SetFontTexture (FontObject *pFont, VideoTexture *pTexture)
 Link a font to a texture. More...
 
CAVESTORY_MOD_API FontObject * LoadFontFromData (const unsigned char *data, size_t data_size, unsigned int cell_width, unsigned int cell_height, VideoTexture *pTexture=NULL, FontManager *pManager=NULL)
 Load a font object from data. More...
 
CAVESTORY_MOD_API FontObject * LoadFont (const char *font_filename, unsigned int cell_width, unsigned int cell_height, VideoTexture *pTexture=NULL, FontManager *pManager=NULL)
 Load a font from Windows. More...
 
CAVESTORY_MOD_API void GetTextSize (FontObject *font_object, const char *string, size_t string_length, int *size_x, int *size_y)
 Get the rendered size of text. More...
 
CAVESTORY_MOD_API unsigned int GetTextWidth (FontObject *font_object, const char *string, size_t string_length=size_t(-1))
 Get the rendered width of text. More...
 
CAVESTORY_MOD_API unsigned int GetTextHeight (FontObject *font_object, const char *string, size_t string_length=size_t(-1))
 Get the rendered height of text. More...
 
CAVESTORY_MOD_API BOOL IsFontLinkedToTexture (FontObject *font_object, VideoTexture *pTexture)
 Check to see if a font is linked with a texture. More...
 
CAVESTORY_MOD_API int GetFontMagnification (FontObject *font_object)
 Get the magnification level of a font object. More...
 
CAVESTORY_MOD_API int GetFontHeight (FontObject *font_object)
 Get the general render height of a font. More...
 
CAVESTORY_MOD_API void DrawNormalText (FontObject *font_object, unsigned char *bitmap_buffer, size_t bitmap_pitch, int bitmap_width, int bitmap_height, int x, int y, unsigned long colour, const char *string, size_t string_length)
 Draw normal text onto a bitmap. More...
 
CAVESTORY_MOD_API void DrawClippedText (FontObject *font_object, unsigned char *bitmap_buffer, size_t bitmap_pitch, int bitmap_width, int bitmap_height, int x, int y, unsigned long colour, const char *string, size_t string_length, int clipLEFT, int clipTOP, int clipRIGHT, int clipBOTTOM, float iOutAlpha=1.f)
 Draw clipped text onto a bitmap. More...
 
CAVESTORY_MOD_API void UnloadFont (FontObject *font_object)
 Unload a font object. More...
 
CAVESTORY_MOD_API unsigned long UTF8ToUnicode (const unsigned char *string, unsigned int *bytes_read)
 Convert UTF8 to unicode. More...
 
CAVESTORY_MOD_API void InitFont ()
 Do not use.
 
CAVESTORY_MOD_API void DeInitFont ()
 Do not use.
 
CAVESTORY_MOD_API void CSM_QSA_Begin (Surface_Ids sid, GUI_RECT *rect, CSM_QSA_Data *out)
 Begin the quick surface access.
 
CAVESTORY_MOD_API void CSM_QSA_Free (CSM_QSA_Data *qsaptr)
 Free QSA access.
 
CAVESTORY_MOD_API void PutFramePerSecound ()
 Draw FPS in the top-right corner.
 
CAVESTORY_MOD_API BOOL Flip_SystemTask (int hWnd)
 Flip the renderer. More...
 
CAVESTORY_MOD_API void PutBitmap3 (RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no)
 Draw bitmap to the screen with transparency. More...
 
CAVESTORY_MOD_API void PutBitmap4 (RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no)
 Draw bitmap to the screen. More...
 
CAVESTORY_MOD_API void PutBitmap5 (RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no, int scalar)
 Draw bitmap to the screen. More...
 
CAVESTORY_MOD_API void PutBitmap6 (RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no, int scalar)
 Draw bitmap to the screen. More...
 
CAVESTORY_MOD_API void PutBitmap7 (RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no)
 Draw bitmap to the screen. More...
 
CAVESTORY_MOD_API void PutBitmap8 (RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no, int r, int g, int b)
 Draw bitmap to the screen. More...
 
CAVESTORY_MOD_API void PutBitmap9 (RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no, int alpha)
 Draw bitmap to the screen. More...
 
CAVESTORY_MOD_API void PutBitmap10 (int x, int y, RECT *rect, Surface_Ids surf_no)
 Draw bitmap to the screen. More...
 
CAVESTORY_MOD_API void PutBitmap11 (int x, int y, RECT *rect, Surface_Ids surf_no, int r, int g, int b)
 Draw bitmap to the screen. More...
 
CAVESTORY_MOD_API void PutBitmap12 (RECT *rcView, Surface_Ids dst_surf_no, int x, int y, RECT *src_rect, Surface_Ids src_surf_no, bool async=false)
 Draw bitmap to the screen with transparency. More...
 
CAVESTORY_MOD_API void PutBitmap13 (RECT *rcView, Surface_Ids dst_surf_no, int x, int y, RECT *src_rect, Surface_Ids src_surf_no, int r, int g, int b, bool async=false)
 Draw bitmap to the screen with transparency & color modulation. More...
 
CAVESTORY_MOD_API void PutBitmap14 (int x, int y, int w, int h, RECT *rect, Surface_Ids surf_no, int r, int g, int b)
 Draw a stretched colored bitmap to the screen. More...
 
CAVESTORY_MOD_API void PutBitmap15 (RECT *pDstRect, RECT *pSrcRect, Surface_Ids iSurfaceNo)
 Draw a surface directly to the screen. More...
 
CAVESTORY_MOD_API void PutBitmap16 (RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no, float angle, int center_x, int center_y)
 Draw a bitmap that's rotated around a center point. More...
 
CAVESTORY_MOD_API void PutBitmap17 (RECT *pDstRect, RECT *pSrcRect, Surface_Ids iSurfaceNo)
 Draw a surface directly to the screen, with magnified support. More...
 
CAVESTORY_MOD_API void PutBitmap18 (RECT *pDstRect, RECT *pSrcRect, Surface_Ids iSurfaceNo, Surface_Ids iDestSurfaceNo)
 Draw a surface directly to another surface, with magnified support. More...
 
CAVESTORY_MOD_API void ModBitmap (Surface_Ids iSurfNo, unsigned long iColor)
 Set the color modulation of a surface. More...
 
CAVESTORY_MOD_API void ClearBitmapMod (Surface_Ids iSurfNo)
 Clear the color modulation of a surface. More...
 
CAVESTORY_MOD_API void PutNumber3 (int x, int y, int value)
 Draw a number to the screen. More...
 
CAVESTORY_MOD_API void PutNumber4 (int x, int y, int value, BOOL bZero)
 Draw a number to the screen. More...
 
CAVESTORY_MOD_API void PutSpecificNpChar (NPCHAR *npc, int fx, int fy, bool bIgnorePutFunc=false, int *iDrawX=NULL, int *iDrawY=NULL)
 Draw an NPC to the screen. More...
 

Variables

class CAVESTORY_MOD_API FontManager
 
CAVESTORY_MOD_API int ghWnd
 Placeholder until we restore the WinAPI code.