expose a lot more to plugins

This commit is contained in:
UnknownShadow200 2019-04-22 20:36:59 +10:00
parent 497b9d7f3e
commit 76b1f70fe4
3 changed files with 48 additions and 48 deletions

View File

@ -34,42 +34,42 @@ bool Drawer2D_Clamp(Bitmap* bmp, int* x, int* y, int* width, int* height);
/* Fills the given area with a simple noisy pattern. */ /* Fills the given area with a simple noisy pattern. */
/* Variation determines how 'visible/obvious' the noise is. */ /* Variation determines how 'visible/obvious' the noise is. */
void Gradient_Noise(Bitmap* bmp, BitmapCol col, int variation, CC_API void Gradient_Noise(Bitmap* bmp, BitmapCol col, int variation,
int x, int y, int width, int height); int x, int y, int width, int height);
/* Fills the given area with a vertical gradient, linerarly interpolating from a to b. */ /* Fills the given area with a vertical gradient, linerarly interpolating from a to b. */
/* First drawn row is filled with 'a', while last drawn is filled with 'b'. */ /* First drawn row is filled with 'a', while last drawn is filled with 'b'. */
void Gradient_Vertical(Bitmap* bmp, BitmapCol a, BitmapCol b, CC_API void Gradient_Vertical(Bitmap* bmp, BitmapCol a, BitmapCol b,
int x, int y, int width, int height); int x, int y, int width, int height);
/* Blends the given area with the given colour. */ /* Blends the given area with the given colour. */
/* Note that this only blends RGB, A is not blended. */ /* Note that this only blends RGB, A is not blended. */
void Gradient_Blend(Bitmap* bmp, BitmapCol col, int blend, CC_API void Gradient_Blend(Bitmap* bmp, BitmapCol col, int blend,
int x, int y, int width, int height); int x, int y, int width, int height);
/* Tints the given area, linearly interpolating from a to b. */ /* Tints the given area, linearly interpolating from a to b. */
/* Note that this only tints RGB, A is not tinted. */ /* Note that this only tints RGB, A is not tinted. */
void Gradient_Tint(Bitmap* bmp, uint8_t tintA, uint8_t tintB, CC_API void Gradient_Tint(Bitmap* bmp, uint8_t tintA, uint8_t tintB,
int x, int y, int width, int height); int x, int y, int width, int height);
/* Fills the given area using pixels from an indexed bitmap. */ /* Fills the given area using pixels from an indexed bitmap. */
/* TODO: Currently this only handles square areas. */ /* TODO: Currently this only handles square areas. */
void Drawer2D_BmpIndexed(Bitmap* bmp, int x, int y, int size, CC_API void Drawer2D_BmpIndexed(Bitmap* bmp, int x, int y, int size,
uint8_t* indices, BitmapCol* palette); uint8_t* indices, BitmapCol* palette);
/* Fills the given area using pixels from a region in the source bitmap, by repeatedly tiling the region. */ /* Fills the given area using pixels from a region in the source bitmap, by repeatedly tiling the region. */
/* The pixels from the region are then scaled upwards or downwards depending on scale width and height. */ /* The pixels from the region are then scaled upwards or downwards depending on scale width and height. */
void Drawer2D_BmpScaled(Bitmap* dst, int x, int y, int width, int height, CC_API void Drawer2D_BmpScaled(Bitmap* dst, int x, int y, int width, int height,
Bitmap* src, int srcX, int srcY, int srcWidth, int srcHeight, Bitmap* src, int srcX, int srcY, int srcWidth, int srcHeight,
int scaleWidth, int scaleHeight); int scaleWidth, int scaleHeight);
/* Fills the given area using pixels from a region in the source bitmap, by repeatedly tiling the region. */ /* Fills the given area using pixels from a region in the source bitmap, by repeatedly tiling the region. */
/* For example, if area was 12x5 and region was 5x5, region gets drawn at (0,0), (5,0), (10,0) */ /* For example, if area was 12x5 and region was 5x5, region gets drawn at (0,0), (5,0), (10,0) */
/* NOTE: The tiling origin is at (0, 0) not at (x, y) */ /* NOTE: The tiling origin is at (0, 0) not at (x, y) */
void Drawer2D_BmpTiled(Bitmap* dst, int x, int y, int width, int height, CC_API void Drawer2D_BmpTiled(Bitmap* dst, int x, int y, int width, int height,
Bitmap* src, int srcX, int srcY, int srcWidth, int srcHeight); Bitmap* src, int srcX, int srcY, int srcWidth, int srcHeight);
/* Fills the given area using pixels from the source bitmap. */ /* Fills the given area using pixels from the source bitmap. */
void Drawer2D_BmpCopy(Bitmap* dst, int x, int y, Bitmap* src); CC_API void Drawer2D_BmpCopy(Bitmap* dst, int x, int y, Bitmap* src);
/* Fills the given area with the given colour, then draws blended borders around it. */ /* Fills the given area with the given colour, then draws blended borders around it. */
void Drawer2D_Rect(Bitmap* bmp, BitmapCol col, int x, int y, int width, int height); CC_API void Drawer2D_Rect(Bitmap* bmp, BitmapCol col, int x, int y, int width, int height);
/* Fills the area with the given colour. */ /* Fills the area with the given colour. */
void Drawer2D_Clear(Bitmap* bmp, BitmapCol col, int x, int y, int width, int height); CC_API void Drawer2D_Clear(Bitmap* bmp, BitmapCol col, int x, int y, int width, int height);
void Drawer2D_Underline(Bitmap* bmp, int x, int y, int width, int height, BitmapCol col); void Drawer2D_Underline(Bitmap* bmp, int x, int y, int width, int height, BitmapCol col);
/* Draws text using the given font at the given coordinates. */ /* Draws text using the given font at the given coordinates. */

View File

@ -40,9 +40,9 @@ void Platform_Init(void);
void Platform_Free(void); void Platform_Free(void);
/* Sets current/working directory to the given directory. */ /* Sets current/working directory to the given directory. */
/* This is the 'base directory' relative paths are relative to. */ /* This is the 'base directory' relative paths are relative to. */
ReturnCode Platform_SetCurrentDirectory(const String* path); CC_API ReturnCode Platform_SetCurrentDirectory(const String* path);
/* Marks a file as being executable. */ /* Marks a file as being executable. */
ReturnCode Platform_MarkExecutable(const String* path); CC_API ReturnCode Platform_MarkExecutable(const String* path);
/* Gets the command line arguments passed to the program. */ /* Gets the command line arguments passed to the program. */
int Platform_GetCommandLineArgs(int argc, STRING_REF const char** argv, String* args); int Platform_GetCommandLineArgs(int argc, STRING_REF const char** argv, String* args);
@ -58,14 +58,14 @@ describe exists (e.g. DynamicLib_DescribeError), that should be preferred. */
bool Platform_DescribeError(ReturnCode res, String* dst); bool Platform_DescribeError(ReturnCode res, String* dst);
/* Returns the full path of the application's executable. */ /* Returns the full path of the application's executable. */
ReturnCode Process_GetExePath(String* path); CC_API ReturnCode Process_GetExePath(String* path);
/* Starts the given program with the given arguments. */ /* Starts the given program with the given arguments. */
ReturnCode Process_Start(const String* path, const String* args); CC_API ReturnCode Process_Start(const String* path, const String* args);
/* Starts the platform-specific program to open the given url or filename. */ /* Starts the platform-specific program to open the given url or filename. */
/* For example, provide a http:// url to open a website in the user's web browser. */ /* For example, provide a http:// url to open a website in the user's web browser. */
ReturnCode Process_StartOpen(const String* args); CC_API ReturnCode Process_StartOpen(const String* args);
/* Exits the process with the given return code .*/ /* Terminates the process with the given return code. */
void Process_Exit(ReturnCode code); CC_API void Process_Exit(ReturnCode code);
/* Attempts to load a native dynamic library from the given path. */ /* Attempts to load a native dynamic library from the given path. */
CC_API ReturnCode DynamicLib_Load(const String* path, void** lib); CC_API ReturnCode DynamicLib_Load(const String* path, void** lib);
@ -104,32 +104,32 @@ void Platform_Log3(const char* format, const void* a1, const void* a2, const voi
void Platform_Log4(const char* format, const void* a1, const void* a2, const void* a3, const void* a4); void Platform_Log4(const char* format, const void* a1, const void* a2, const void* a3, const void* a4);
/* Returns the current UTC time, as number of milliseconds since 1/1/0001 */ /* Returns the current UTC time, as number of milliseconds since 1/1/0001 */
TimeMS DateTime_CurrentUTC_MS(void); CC_API TimeMS DateTime_CurrentUTC_MS(void);
/* Returns the current UTC Time. */ /* Returns the current UTC Time. */
/* NOTE: Generally DateTime_CurrentUTC_MS should be used instead. */ /* NOTE: Generally DateTime_CurrentUTC_MS should be used instead. */
void DateTime_CurrentUTC(struct DateTime* time); CC_API void DateTime_CurrentUTC(struct DateTime* time);
/* Returns the current local Time. */ /* Returns the current local Time. */
void DateTime_CurrentLocal(struct DateTime* time); CC_API void DateTime_CurrentLocal(struct DateTime* time);
/* Takes a platform-specific stopwatch measurement. */ /* Takes a platform-specific stopwatch measurement. */
/* NOTE: The value returned is platform-specific - do NOT try to interpret the value. */ /* NOTE: The value returned is platform-specific - do NOT try to interpret the value. */
uint64_t Stopwatch_Measure(void); CC_API uint64_t Stopwatch_Measure(void);
/* Returns total elapsed microseconds between two stopwatch measurements. */ /* Returns total elapsed microseconds between two stopwatch measurements. */
uint64_t Stopwatch_ElapsedMicroseconds(uint64_t beg, uint64_t end); CC_API uint64_t Stopwatch_ElapsedMicroseconds(uint64_t beg, uint64_t end);
/* Returns whether the given directory exists. */ /* Returns whether the given directory exists. */
bool Directory_Exists(const String* path); CC_API bool Directory_Exists(const String* path);
/* Attempts to create a new directory. */ /* Attempts to create a new directory. */
ReturnCode Directory_Create(const String* path); CC_API ReturnCode Directory_Create(const String* path);
/* Callback function invoked for each file found. */ /* Callback function invoked for each file found. */
typedef void Directory_EnumCallback(const String* filename, void* obj); typedef void Directory_EnumCallback(const String* filename, void* obj);
/* Invokes a callback function on all filenames in the given directory (and its sub-directories) */ /* Invokes a callback function on all filenames in the given directory (and its sub-directories) */
ReturnCode Directory_Enum(const String* path, void* obj, Directory_EnumCallback callback); CC_API ReturnCode Directory_Enum(const String* path, void* obj, Directory_EnumCallback callback);
/* Returns whether the given file exists. */ /* Returns whether the given file exists. */
bool File_Exists(const String* path); CC_API bool File_Exists(const String* path);
/* Returns the last time the file was modified, as number of milliseconds since 1/1/0001 */ /* Returns the last time the file was modified, as number of milliseconds since 1/1/0001 */
ReturnCode File_GetModifiedTime(const String* path, TimeMS* ms); CC_API ReturnCode File_GetModifiedTime(const String* path, TimeMS* ms);
/* Sets the last time the file was modified, as number of milliseconds since 1/1/0001 */ /* Sets the last time the file was modified, as number of milliseconds since 1/1/0001 */
ReturnCode File_SetModifiedTime(const String* path, TimeMS ms); CC_API ReturnCode File_SetModifiedTime(const String* path, TimeMS ms);
/* Attempts to create a new (or overwrite) file for writing. */ /* Attempts to create a new (or overwrite) file for writing. */
/* NOTE: If the file already exists, its contents are discarded. */ /* NOTE: If the file already exists, its contents are discarded. */
@ -199,25 +199,25 @@ int Platform_FontHeight(const FontDesc* font);
int Platform_TextDraw(struct DrawTextArgs* args, Bitmap* bmp, int x, int y, BitmapCol col, bool shadow); int Platform_TextDraw(struct DrawTextArgs* args, Bitmap* bmp, int x, int y, BitmapCol col, bool shadow);
/* Allocates a new socket. */ /* Allocates a new socket. */
void Socket_Create(SocketHandle* socket); CC_API void Socket_Create(SocketHandle* socket);
/* Returns how much data is available to be read from the given socket. */ /* Returns how much data is available to be read from the given socket. */
ReturnCode Socket_Available(SocketHandle socket, uint32_t* available); CC_API ReturnCode Socket_Available(SocketHandle socket, uint32_t* available);
/* Sets whether operations on the given socket block the calling thread. */ /* Sets whether operations on the given socket block the calling thread. */
/* e.g. if blocking is on, calling Connect() blocks until a response is received. */ /* e.g. if blocking is on, calling Connect() blocks until a response is received. */
ReturnCode Socket_SetBlocking(SocketHandle socket, bool blocking); CC_API ReturnCode Socket_SetBlocking(SocketHandle socket, bool blocking);
/* Returns (and resets) the last error generated by the given socket. */ /* Returns (and resets) the last error generated by the given socket. */
ReturnCode Socket_GetError(SocketHandle socket, ReturnCode* result); CC_API ReturnCode Socket_GetError(SocketHandle socket, ReturnCode* result);
/* Attempts to initalise a connection to the given IP address:port. */ /* Attempts to initalise a connection to the given IP address:port. */
ReturnCode Socket_Connect(SocketHandle socket, const String* ip, int port); CC_API ReturnCode Socket_Connect(SocketHandle socket, const String* ip, int port);
/* Attempts to read data from the given socket. */ /* Attempts to read data from the given socket. */
ReturnCode Socket_Read(SocketHandle socket, uint8_t* buffer, uint32_t count, uint32_t* modified); CC_API ReturnCode Socket_Read(SocketHandle socket, uint8_t* buffer, uint32_t count, uint32_t* modified);
/* Attempts to write data to the given socket. */ /* Attempts to write data to the given socket. */
ReturnCode Socket_Write(SocketHandle socket, uint8_t* buffer, uint32_t count, uint32_t* modified); CC_API ReturnCode Socket_Write(SocketHandle socket, uint8_t* buffer, uint32_t count, uint32_t* modified);
/* Attempts to close the given socket. */ /* Attempts to close the given socket. */
ReturnCode Socket_Close(SocketHandle socket); CC_API ReturnCode Socket_Close(SocketHandle socket);
/* Attempts to poll the given socket for readability or writability. */ /* Attempts to poll the given socket for readability or writability. */
/* NOTE: A closed socket is still considered readable. */ /* NOTE: A closed socket is still considered readable. */
/* NOTE: A socket is considered writable once it has finished connecting. */ /* NOTE: A socket is considered writable once it has finished connecting. */
ReturnCode Socket_Poll(SocketHandle socket, int mode, bool* success); CC_API ReturnCode Socket_Poll(SocketHandle socket, int mode, bool* success);
#endif #endif

View File

@ -53,13 +53,13 @@ void Window_CreateSimple(int width, int height);
/* Creates the window as the given size at the given position on screen. */ /* Creates the window as the given size at the given position on screen. */
void Window_Create(int x, int y, int width, int height, struct GraphicsMode* mode); void Window_Create(int x, int y, int width, int height, struct GraphicsMode* mode);
/* Sets the text of the titlebar above the window. */ /* Sets the text of the titlebar above the window. */
void Window_SetTitle(const String* title); CC_API void Window_SetTitle(const String* title);
/* Gets the text currently on the clipboard. */ /* Gets the text currently on the clipboard. */
/* NOTE: You MUST have created the window beforehand. (necessary for X11) */ /* NOTE: You MUST have created the window beforehand. (necessary for X11) */
void Window_GetClipboardText(String* value); CC_API void Window_GetClipboardText(String* value);
/* Sets the text currently on the clipboard. */ /* Sets the text currently on the clipboard. */
/* NOTE: You MUST have created the window beforehand. (necessary for X11) */ /* NOTE: You MUST have created the window beforehand. (necessary for X11) */
void Window_SetClipboardText(const String* value); CC_API void Window_SetClipboardText(const String* value);
/* TODO: IMPLEMENT void Window_SetIcon(Bitmap* bmp); */ /* TODO: IMPLEMENT void Window_SetIcon(Bitmap* bmp); */
/* Whether the window is actually valid (i.e. not destroyed). */ /* Whether the window is actually valid (i.e. not destroyed). */