浏览代码

ADDED: OpenURL()

Corrected bug on ImageDrawRectangleLines()
pull/685/head
Ray 6 年前
父节点
当前提交
5167f78d5f
共有 3 个文件被更改,包括 27 次插入4 次删除
  1. +21
    -0
      src/core.c
  2. +2
    -0
      src/raylib.h
  3. +4
    -4
      src/textures.c

+ 21
- 0
src/core.c 查看文件

@ -1819,6 +1819,27 @@ int StorageLoadValue(int position)
return value; return value;
} }
// Open URL with default system browser (if available)
void OpenURL(const char *url)
{
// Max length is "explorer ".length + url.maxlength (which is 2083),
// but we are not wasting that much memory here... let's set it up to 512
static char cmd[512] = { 0 };
#if defined(_WIN32)
strcpy(cmd, "explorer ");
#elif defined(__linux__)
strcpy(cmd, "xdg-open "); // Alternatives: firefox, x-www-browser
#elif defined(__APPLE__)
strcpy(cmd, "open ");
#endif
strcat(cmd, url);
system(cmd);
memset(cmd, 0, 512);
}
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module Functions Definition - Input (Keyboard, Mouse, Gamepad) Functions // Module Functions Definition - Input (Keyboard, Mouse, Gamepad) Functions
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

+ 2
- 0
src/raylib.h 查看文件

@ -887,6 +887,8 @@ RLAPI long GetFileModTime(const char *fileName); // Get file mo
RLAPI void StorageSaveValue(int position, int value); // Save integer value to storage file (to defined position) RLAPI void StorageSaveValue(int position, int value); // Save integer value to storage file (to defined position)
RLAPI int StorageLoadValue(int position); // Load integer value from storage file (from defined position) RLAPI int StorageLoadValue(int position); // Load integer value from storage file (from defined position)
RLAPI void OpenURL(const char *url); // Open URL with default system browser (if available)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Input Handling Functions (Module: core) // Input Handling Functions (Module: core)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------

+ 4
- 4
src/textures.c 查看文件

@ -1741,10 +1741,10 @@ void ImageDrawRectangle(Image *dst, Rectangle rec, Color color)
// Draw rectangle lines within an image // Draw rectangle lines within an image
void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color) void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color)
{ {
ImageDrawRectangle(o">&dst, (Rectangle){ rec.x, rec.y, rec.width, thick }, color);
ImageDrawRectangle(o">&dst, (Rectangle){ rec.x, rec.y + thick, thick, rec.height - thick*2 }, color);
ImageDrawRectangle(o">&dst, (Rectangle){ rec.x + rec.width - thick, rec.y + thick, thick, rec.height - thick*2 }, color);
ImageDrawRectangle(o">&dst, (Rectangle){ rec.x, rec.height - thick, rec.width, thick }, color);
ImageDrawRectangle(dst, (Rectangle){ rec.x, rec.y, rec.width, thick }, color);
ImageDrawRectangle(dst, (Rectangle){ rec.x, rec.y + thick, thick, rec.height - thick*2 }, color);
ImageDrawRectangle(dst, (Rectangle){ rec.x + rec.width - thick, rec.y + thick, thick, rec.height - thick*2 }, color);
ImageDrawRectangle(dst, (Rectangle){ rec.x, rec.height - thick, rec.width, thick }, color);
} }
// Draw text (default font) within an image (destination) // Draw text (default font) within an image (destination)

正在加载...
取消
保存