瀏覽代碼

ADDED: New function `ColorIsEqual()`

pull/3849/head
Ray 1 年之前
父節點
當前提交
1e8450665c
共有 2 個檔案被更改,包括 11 行新增0 行删除
  1. +1
    -0
      src/raylib.h
  2. +10
    -0
      src/rtextures.c

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

@ -1408,6 +1408,7 @@ RLAPI void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, V
RLAPI void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draws a texture (or part of it) that stretches or shrinks nicely RLAPI void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draws a texture (or part of it) that stretches or shrinks nicely
// Color/pixel related functions // Color/pixel related functions
RLAPI bool ColorIsEqual(Color col1, Color col2); // Check if two colors are equal
RLAPI Color Fade(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f RLAPI Color Fade(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f
RLAPI int ColorToInt(Color color); // Get hexadecimal value for a Color RLAPI int ColorToInt(Color color); // Get hexadecimal value for a Color
RLAPI Vector4 ColorNormalize(Color color); // Get Color normalized as float [0..1] RLAPI Vector4 ColorNormalize(Color color); // Get Color normalized as float [0..1]

+ 10
- 0
src/rtextures.c 查看文件

@ -4453,6 +4453,16 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
} }
} }
// Check if two colors are equal
bool ColorIsEqual(Color col1, Color col2)
{
bool result = false;
if ((col1.r == col2.r) && (col1.g == col2.g) && (col1.b == col2.b) && (col1.a == col2.a)) result = true;
return result;
}
// Get color with alpha applied, alpha goes from 0.0f to 1.0f // Get color with alpha applied, alpha goes from 0.0f to 1.0f
Color Fade(Color color, float alpha) Color Fade(Color color, float alpha)
{ {

Loading…
取消
儲存