Skip to content

Latest commit

 

History

History
1185 lines (879 loc) · 22.2 KB

Api.md

File metadata and controls

1185 lines (879 loc) · 22.2 KB

ClassiCube Plugin API Docs

Plugin API version: 1

These are the functions that are marked available for use in plugins. Note that the following are only the functions, not the macros, structs, or anything else provided in the headers.

Table of Contents

void Bitmap_Scale (struct Bitmap* dst, struct Bitmap* src, int srcX, int srcY, int srcWidth, int srcHeight)
cc_result Png_Decode (struct Bitmap* bmp, struct Stream* stream)
cc_string Block_UNSAFE_GetName (BlockID block)
int Block_FindID (const cc_string* name)
int Block_Parse (const cc_string* name)
void Camera_Register (struct Camera* camera)
void Chat_Send (const cc_string* text, cc_bool logUsage)
void Chat_Add (const cc_string* text)
void Chat_AddOf (const cc_string* text, int msgType)
void Commands_Register (struct ChatCommand* cmd)
void Inflate_Init2 (struct InflateState* state, struct Stream* source)
void Inflate_MakeStream2 (struct Stream* stream, struct InflateState* state, struct Stream* underlying)
void Deflate_MakeStream (struct Stream* stream, struct DeflateState* state, struct Stream* underlying)
void GZip_MakeStream (struct Stream* stream, struct GZipState* state, struct Stream* underlying)
void ZLib_MakeStream (struct Stream* stream, struct ZLibState* state, struct Stream* underlying)
cc_result Zip_Extract (struct Stream* source, Zip_SelectEntry selector, Zip_ProcessEntry processor)
void Context2D_Alloc (struct Context2D* ctx, int width, int height)
void Context2D_Wrap (struct Context2D* ctx, struct Bitmap* bmp)
void Context2D_Free (struct Context2D* ctx)
void Context2D_MakeTexture (struct Texture* tex, struct Context2D* ctx)
void Context2D_DrawText (struct Context2D* ctx, struct DrawTextArgs* args, int x, int y)
void Context2D_DrawPixels (struct Context2D* ctx, int x, int y, struct Bitmap* src)
void Context2D_Clear (struct Context2D* ctx, BitmapCol color, int x, int y, int width, int height)
void Gradient_Noise (struct Context2D* ctx, BitmapCol color, int variation, int x, int y, int width, int height)
void Gradient_Vertical (struct Context2D* ctx, BitmapCol a, BitmapCol b, int x, int y, int width, int height)
void Gradient_Blend (struct Context2D* ctx, BitmapCol color, int blend, int x, int y, int width, int height)
int Drawer2D_TextWidth (struct DrawTextArgs* args)
int Drawer2D_TextHeight (struct DrawTextArgs* args)
void Drawer2D_MakeTextTexture (struct Texture* tex, struct DrawTextArgs* args)
void Font_Make (struct FontDesc* desc, int size, int flags)
void Font_Free (struct FontDesc* desc)
void Drawer_XMin (int count, PackedCol col, TextureLoc texLoc, struct VertexTextured** vertices)
void Drawer_XMax (int count, PackedCol col, TextureLoc texLoc, struct VertexTextured** vertices)
void Drawer_ZMin (int count, PackedCol col, TextureLoc texLoc, struct VertexTextured** vertices)
void Drawer_ZMax (int count, PackedCol col, TextureLoc texLoc, struct VertexTextured** vertices)
void Drawer_YMin (int count, PackedCol col, TextureLoc texLoc, struct VertexTextured** vertices)
void Drawer_YMax (int count, PackedCol col, TextureLoc texLoc, struct VertexTextured** vertices)
void Entity_GetTransform (struct Entity* e, Vec3 pos, Vec3 scale, struct Matrix* m)
void Entity_SetModel (struct Entity* e, const cc_string* model)
cc_bool Entity_TouchesAny (struct AABB* bb, Entity_TouchesCondition cond)
void TabList_Remove (EntityID id)
void TabList_Set (EntityID id, const cc_string* player, const cc_string* list, const cc_string* group, cc_uint8 rank)
void NetPlayer_Init (struct NetPlayer* player)
void Event_Register (struct Event_Void* handlers, void* obj, Event_Void_Callback handler)
void Event_Unregister (struct Event_Void* handlers, void* obj, Event_Void_Callback handler)
void Event_RaiseVoid (struct Event_Void* handlers)
void Event_RaiseInt (struct Event_Int* handlers, int arg)
void Event_RaiseFloat (struct Event_Float* handlers, float arg)
double Math_Sin (double x)
double Math_Cos (double x)
void Random_Seed (RNGState* rnd, int seed)
int Random_Next (RNGState* rnd, int n)
float Random_Float (RNGState* rnd)
void MapImporter_Register (struct MapImporter* imp)
struct MapImporter* MapImporter_Find (const cc_string* path)
cc_result Map_LoadFrom (const cc_string* path)
void Game_UpdateBlock (int x, int y, int z, BlockID block)
void Game_ChangeBlock (int x, int y, int z, BlockID block)
int ScheduledTask_Add (double interval, ScheduledTaskCallback callback)
GfxResourceID Gfx_CreateTexture (struct Bitmap* bmp, cc_uint8 flags, cc_bool mipmaps)
void Gfx_UpdateTexturePart (GfxResourceID texId, int x, int y, struct Bitmap* part, cc_bool mipmaps)
void Gfx_BindTexture (GfxResourceID texId)
void Gfx_DeleteTexture (GfxResourceID* texId)
void Gfx_SetTexturing (cc_bool enabled)
void Gfx_EnableMipmaps (void)
void Gfx_DisableMipmaps (void)
cc_bool Gfx_GetFog (void)
void Gfx_SetFog (cc_bool enabled)
void Gfx_SetFogCol (PackedCol col)
void Gfx_SetFogDensity (float value)
void Gfx_SetFogEnd (float value)
void Gfx_SetFogMode (FogFunc func)
void Gfx_SetFaceCulling (cc_bool enabled)
void Gfx_SetAlphaTest (cc_bool enabled)
void Gfx_SetAlphaBlending (cc_bool enabled)
void Gfx_SetAlphaArgBlend (cc_bool enabled)
void Gfx_Clear (void)
void Gfx_ClearCol (PackedCol col)
void Gfx_SetDepthTest (cc_bool enabled)
void Gfx_SetColWriteMask (cc_bool r, cc_bool g, cc_bool b, cc_bool a)
void Gfx_SetDepthWrite (cc_bool enabled)
void Gfx_DepthOnlyRendering (cc_bool depthOnly)
GfxResourceID Gfx_CreateIb2 (int count, Gfx_FillIBFunc fillFunc, void* obj)
void Gfx_BindIb (GfxResourceID ib)
void Gfx_DeleteIb (GfxResourceID* ib)
GfxResourceID Gfx_CreateVb (VertexFormat fmt, int count)
void Gfx_BindVb (GfxResourceID vb)
void Gfx_DeleteVb (GfxResourceID* vb)
void* Gfx_LockVb (GfxResourceID vb, VertexFormat fmt, int count)
void Gfx_UnlockVb (GfxResourceID vb)
GfxResourceID Gfx_CreateDynamicVb (VertexFormat fmt, int maxVertices)
void Gfx_BindDynamicVb (GfxResourceID vb)
void Gfx_DeleteDynamicVb (GfxResourceID* vb)
void* Gfx_LockDynamicVb (GfxResourceID vb, VertexFormat fmt, int count)
void Gfx_UnlockDynamicVb (GfxResourceID vb)
void Gfx_SetDynamicVbData (GfxResourceID vb, void* vertices, int vCount)
void Gfx_SetVertexFormat (VertexFormat fmt)
void Gfx_DrawVb_Lines (int verticesCount)
void Gfx_DrawVb_IndexedTris_Range (int verticesCount, int startVertex)
void Gfx_DrawVb_IndexedTris (int verticesCount)
void Gfx_LoadMatrix (MatrixType type, const struct Matrix* matrix)
void Gfx_LoadIdentityMatrix (MatrixType type)
void Gfx_EnableTextureOffset (float x, float y)
void Gfx_DisableTextureOffset (void)
void Gui_Remove (struct Screen* screen)
void Gui_Add (struct Screen* screen, int priority)
struct Screen* Gui_GetInputGrab (void)
cc_bool KeyBind_IsPressed (KeyBind binding)
void Model_Init (struct Model* model)
void Model_Render (struct Model* model, struct Entity* entity)
void Model_SetupState (struct Model* model, struct Entity* entity)
void Model_ApplyTexture (struct Entity* entity)
void Model_UpdateVB (void)
void Model_DrawPart (struct ModelPart* part)
void Model_DrawRotate (float angleX, float angleY, float angleZ, struct ModelPart* part, cc_bool head)
void Model_DrawArmPart (struct ModelPart* part)
struct Model* Model_Get (const cc_string* name)
void Model_Register (struct Model* model)
void Model_RegisterTexture (struct ModelTex* tex)
void BoxDesc_BuildBox (struct ModelPart* part, const struct BoxDesc* desc)
void BoxDesc_BuildRotatedBox (struct ModelPart* part, const struct BoxDesc* desc)
void BoxDesc_XQuad (struct Model* m, int texX, int texY, int texWidth, int texHeight, float z1, float z2, float y1, float y2, float x, cc_bool swapU)
void BoxDesc_YQuad (struct Model* m, int texX, int texY, int texWidth, int texHeight, float x1, float x2, float z1, float z2, float y, cc_bool swapU)
void BoxDesc_ZQuad (struct Model* m, int texX, int texY, int texWidth, int texHeight, float x1, float x2, float y1, float y2, float z, cc_bool swapU)
void BoxDesc_XQuad2 (struct Model* m, float z1, float z2, float y1, float y2, float x, int u1, int v1, int u2, int v2)
void BoxDesc_YQuad2 (struct Model* m, float x1, float x2, float z1, float z2, float y, int u1, int v1, int u2, int v2)
void BoxDesc_ZQuad2 (struct Model* m, float x1, float x2, float y1, float y2, float z, int u1, int v1, int u2, int v2)
void Options_Reload (void)
void Options_SaveIfChanged (void)
void Options_Get (const char* key, cc_string* value, const char* defValue)
int Options_GetInt (const char* key, int min, int max, int defValue)
cc_bool Options_GetBool (const char* key, cc_bool defValue)
float Options_GetFloat (const char* key, float min, float max, float defValue)
int Options_GetEnum (const char* key, int defValue, const char* const* names, int namesCount)
void Options_SetBool (const char* keyRaw, cc_bool value)
void Options_SetInt (const char* keyRaw, int value)
void Options_Set (const char* keyRaw, const cc_string* value)
void Options_SetString (const cc_string* key, const cc_string* value)
PackedCol PackedCol_Scale (PackedCol value, float t)
PackedCol PackedCol_Lerp (PackedCol a, PackedCol b, float t)
PackedCol PackedCol_Tint (PackedCol a, PackedCol b)
void AABB_Make (struct AABB* result, const Vec3* pos, const Vec3* size)
cc_result Process_StartGame2 (const cc_string* args, int numArgs)
void Process_Exit (cc_result code)
cc_result Process_StartOpen (const cc_string* args)
void* DynamicLib_Load2 (const cc_string* path)
void* DynamicLib_Get2 (void* lib, const char* name)
cc_bool DynamicLib_DescribeError (cc_string* dst)
// OBSOLETE
cc_result DynamicLib_Load (const cc_string* path, void** lib)
// OBSOLETE
cc_result DynamicLib_Get (void* lib, const char* name, void** symbol)
void* Mem_TryAlloc (cc_uint32 numElems, cc_uint32 elemsSize)
void* Mem_TryAllocCleared (cc_uint32 numElems, cc_uint32 elemsSize)
void* Mem_TryRealloc (void* mem, cc_uint32 numElems, cc_uint32 elemsSize)
void* Mem_Alloc (cc_uint32 numElems, cc_uint32 elemsSize, const char* place)
void* Mem_AllocCleared (cc_uint32 numElems, cc_uint32 elemsSize, const char* place)
void* Mem_Realloc (void* mem, cc_uint32 numElems, cc_uint32 elemsSize, const char* place)
void Mem_Free (void* mem)
TimeMS DateTime_CurrentUTC_MS (void)
void DateTime_CurrentLocal (struct DateTime* t)
cc_uint64 Stopwatch_Measure (void)
cc_uint64 Stopwatch_ElapsedMicroseconds (cc_uint64 beg, cc_uint64 end)
cc_result Directory_Create (const cc_string* path)
cc_result Directory_Enum (const cc_string* path, void* obj, Directory_EnumCallback callback)
int File_Exists (const cc_string* path)
void Thread_Sleep (cc_uint32 milliseconds)
void* Thread_Create (Thread_StartFunc func)
void Thread_Start2 (void* handle, Thread_StartFunc func)
void Thread_Detach (void* handle)
void Thread_Join (void* handle)
void* Mutex_Create (void)
void Mutex_Free (void* handle)
void Mutex_Lock (void* handle)
void Mutex_Unlock (void* handle)
void* Waitable_Create (void)
void Waitable_Free (void* handle)
void Waitable_Signal (void* handle)
void Waitable_Wait (void* handle)
void Waitable_WaitFor (void* handle, cc_uint32 milliseconds)
void CPE_SendPluginMessage (cc_uint8 channel, cc_uint8* data)
void Selections_Add (cc_uint8 id, const IVec3* p1, const IVec3* p2, PackedCol color)
void Selections_Remove (cc_uint8 id)
cc_result Stream_Read (struct Stream* s, cc_uint8* buffer, cc_uint32 count)
cc_result Stream_Write (struct Stream* s, const cc_uint8* buffer, cc_uint32 count)
cc_result Stream_OpenFile (struct Stream* s, const cc_string* path)
cc_result Stream_CreateFile (struct Stream* s, const cc_string* path)
void Stream_FromFile (struct Stream* s, cc_file file)
void Stream_ReadonlyPortion (struct Stream* s, struct Stream* source, cc_uint32 len)
void Stream_ReadonlyMemory (struct Stream* s, void* data, cc_uint32 len)
void Stream_ReadonlyBuffered (struct Stream* s, struct Stream* source, void* data, cc_uint32 size)
cc_result Stream_ReadLine (struct Stream* s, cc_string* text)
cc_result Stream_WriteLine (struct Stream* s, cc_string* text)
int String_CalcLen (const char* raw, int capacity)
cc_string String_FromReadonly (const char* buffer)
void String_Copy (cc_string* dst, const cc_string* src)
void String_CopyToRaw (char* dst, int capacity, const cc_string* src)
cc_string String_UNSAFE_Substring (const cc_string* str, int offset, int length)
cc_string String_UNSAFE_SubstringAt (const cc_string* str, int offset)
int String_UNSAFE_Split (const cc_string* str, char c, cc_string* subs, int maxSubs)
void String_UNSAFE_SplitBy (cc_string* str, char c, cc_string* part)
int String_UNSAFE_Separate (const cc_string* str, char c, cc_string* key, cc_string* value)
int String_Equals (const cc_string* a, const cc_string* b)
int String_CaselessEquals (const cc_string* a, const cc_string* b)
int String_CaselessEqualsConst (const cc_string* a, const char* b)
void String_Append (cc_string* str, char c)
void String_AppendBool (cc_string* str, cc_bool value)
void String_AppendInt (cc_string* str, int num)
void String_AppendUInt32 (cc_string* str, cc_uint32 num)
void String_AppendPaddedInt (cc_string* str, int num, int minDigits)
void String_AppendFloat (cc_string* str, float num, int fracDigits)
void String_AppendConst (cc_string* str, const char* src)
void String_AppendString (cc_string* str, const cc_string* src)
void String_AppendColorless (cc_string* str, const cc_string* src)
void String_AppendHex (cc_string* str, cc_uint8 value)
int String_IndexOfAt (const cc_string* str, int offset, char c)
int String_LastIndexOfAt (const cc_string* str, int offset, char c)
void String_InsertAt (cc_string* str, int offset, char c)
void String_DeleteAt (cc_string* str, int offset)
void String_UNSAFE_TrimStart (cc_string* str)
void String_UNSAFE_TrimEnd (cc_string* str)
int String_IndexOfConst (const cc_string* str, const char* sub)
int String_CaselessContains (const cc_string* str, const cc_string* sub)
int String_CaselessStarts (const cc_string* str, const cc_string* sub)
int String_CaselessEnds (const cc_string* str, const cc_string* sub)
int String_Compare (const cc_string* a, const cc_string* b)
void String_Format1 (cc_string* str, const char* format, const void* a1)
void String_Format2 (cc_string* str, const char* format, const void* a1, const void* a2)
void String_Format3 (cc_string* str, const char* format, const void* a1, const void* a2, const void* a3)
void String_Format4 (cc_string* str, const char* format, const void* a1, const void* a2, const void* a3, const void* a4)
cc_bool Convert_TryCodepointToCP437 (cc_codepoint cp, char* c)
cc_bool Convert_ParseUInt8 (const cc_string* str, cc_uint8* value)
cc_bool Convert_ParseUInt16 (const cc_string* str, cc_uint16* value)
cc_bool Convert_ParseInt (const cc_string* str, int* value)
cc_bool Convert_ParseUInt64 (const cc_string* str, cc_uint64* value)
cc_bool Convert_ParseFloat (const cc_string* str, float* value)
cc_bool Convert_ParseBool (const cc_string* str, cc_bool* value)
cc_string StringsBuffer_UNSAFE_Get (struct StringsBuffer* buffer, int i)
void StringsBuffer_Add (struct StringsBuffer* buffer, const cc_string* str)
void StringsBuffer_Remove (struct StringsBuffer* buffer, int index)
void SysFonts_GetNames (struct StringsBuffer* buffer)
void TexturePack_Extract (const cc_string* url)
void Matrix_RotateX (struct Matrix* result, float angle)
void Matrix_RotateY (struct Matrix* result, float angle)
void Matrix_RotateZ (struct Matrix* result, float angle)
void Matrix_Translate (struct Matrix* result, float x, float y, float z)
void Matrix_Scale (struct Matrix* result, float x, float y, float z)
void Matrix_Mul (struct Matrix* result, const struct Matrix* left, const struct Matrix* right)
void Window_SetTitle (const cc_string* title)
void Clipboard_GetText (cc_string* value)
void Clipboard_SetText (const cc_string* value)
void Window_ShowDialog (const char* title, const char* msg)
void World_NewMap (void)
void World_SetNewMap (BlockRaw* blocks, int width, int height, int length)
void Env_Reset (void)
void Env_SetEdgeBlock (BlockID block)
void Env_SetSidesBlock (BlockID block)
void Env_SetEdgeHeight (int height)
void Env_SetSidesOffset (int offset)
void Env_SetCloudsHeight (int height)
void Env_SetCloudsSpeed (float speed)
void Env_SetWeatherSpeed (float speed)
void Env_SetWeatherFade (float rate)
void Env_SetWeather (int weather)
void Env_SetExpFog (cc_bool expFog)
void Env_SetSkyboxHorSpeed (float speed)
void Env_SetSkyboxVerSpeed (float speed)
void Env_SetSkyCol (PackedCol color)
void Env_SetFogCol (PackedCol color)
void Env_SetCloudsCol (PackedCol color)
void Env_SetSkyboxCol (PackedCol color)
void Env_SetSunCol (PackedCol color)
void Env_SetShadowCol (PackedCol color)