More col -> color renaming

This commit is contained in:
UnknownShadow200 2021-09-16 20:07:38 +10:00
parent 477b37fc80
commit c65143e6d0
11 changed files with 96 additions and 100 deletions

View file

@ -105,7 +105,7 @@ void SetWorkingDir(cc_string* title) {
## API
I'm lazy so I will just link to [String.h](src/String.h)
I'm lazy so I will just link to [String.h](/src/String.h)
If you'd rather I provided a more detailed reference here, please let me know.
@ -189,13 +189,9 @@ string::insert -> String_InsertAt
string::erase -> String_DeleteAt
string::substr -> String_UNSAFE_Substring/String_UNSAFE_SubstringAt
string.Split -> String_UNSAFE_Split/String_UNSAFE_SplitBy
string.TrimStart -> String_UNSAFE_TrimStart
string.TrimEnd -> String_UNSAFE_TrimEnd
a.Length -> str.length
a == b -> String_Equals
string.Equals -> String_CaslessEquals (StringComparison.OrdinalIgnoreCase)
string::length -> str.length
a == b -> String_Equals
string::find -> String_IndexOf/String_IndexOfConst
string::rfind -> String_LastIndexOf
string::compare -> String_Compare

View file

@ -71,9 +71,9 @@ void Bitmap_Scale(struct Bitmap* dst, struct Bitmap* src,
#define PNG_PALETTE 256
#define PNG_FourCC(a, b, c, d) (((cc_uint32)a << 24) | ((cc_uint32)b << 16) | ((cc_uint32)c << 8) | (cc_uint32)d)
enum PngCol {
PNG_COL_GRAYSCALE = 0, PNG_COL_RGB = 2, PNG_COL_INDEXED = 3,
PNG_COL_GRAYSCALE_A = 4, PNG_COL_RGB_A = 6
enum PngColor {
PNG_COLOR_GRAYSCALE = 0, PNG_COLOR_RGB = 2, PNG_COLOR_INDEXED = 3,
PNG_COLOR_GRAYSCALE_A = 4, PNG_COLOR_RGB_A = 6
};
enum PngFilter {
@ -271,7 +271,7 @@ static void Png_Expand_RGB_A_16(int width, BitmapCol* palette, cc_uint8* src, Bi
static Png_RowExpander Png_GetExpander(cc_uint8 col, cc_uint8 bitsPerSample) {
switch (col) {
case PNG_COL_GRAYSCALE:
case PNG_COLOR_GRAYSCALE:
switch (bitsPerSample) {
case 1: return Png_Expand_GRAYSCALE_1;
case 2: return Png_Expand_GRAYSCALE_2;
@ -281,14 +281,14 @@ static Png_RowExpander Png_GetExpander(cc_uint8 col, cc_uint8 bitsPerSample) {
}
return NULL;
case PNG_COL_RGB:
case PNG_COLOR_RGB:
switch (bitsPerSample) {
case 8: return Png_Expand_RGB_8;
case 16: return Png_Expand_RGB_16;
}
return NULL;
case PNG_COL_INDEXED:
case PNG_COLOR_INDEXED:
switch (bitsPerSample) {
case 1: return Png_Expand_INDEXED_1;
case 2: return Png_Expand_INDEXED_2;
@ -297,14 +297,14 @@ static Png_RowExpander Png_GetExpander(cc_uint8 col, cc_uint8 bitsPerSample) {
}
return NULL;
case PNG_COL_GRAYSCALE_A:
case PNG_COLOR_GRAYSCALE_A:
switch (bitsPerSample) {
case 8: return Png_Expand_GRAYSCALE_A_8;
case 16: return Png_Expand_GRAYSCALE_A_16;
}
return NULL;
case PNG_COL_RGB_A:
case PNG_COLOR_RGB_A:
switch (bitsPerSample) {
case 8: return Png_Expand_RGB_A_8;
case 16: return Png_Expand_RGB_A_16;
@ -426,14 +426,14 @@ cc_result Png_Decode(struct Bitmap* bmp, struct Stream* stream) {
} break;
case PNG_FourCC('t','R','N','S'): {
if (col == PNG_COL_GRAYSCALE) {
if (col == PNG_COLOR_GRAYSCALE) {
if (dataSize != 2) return PNG_ERR_TRANS_COUNT;
res = Stream_Read(stream, tmp, dataSize);
if (res) return res;
/* RGB is 16 bits big endian, ignore least significant 8 bits */
trnsCol = BitmapCol_Make(tmp[0], tmp[0], tmp[0], 0);
} else if (col == PNG_COL_INDEXED) {
} else if (col == PNG_COLOR_INDEXED) {
if (dataSize > PNG_PALETTE) return PNG_ERR_TRANS_COUNT;
res = Stream_Read(stream, tmp, dataSize);
if (res) return res;
@ -443,7 +443,7 @@ cc_result Png_Decode(struct Bitmap* bmp, struct Stream* stream) {
palette[i] &= BITMAPCOL_RGB_MASK; /* set A to 0 */
palette[i] |= tmp[i] << BITMAPCOL_A_SHIFT;
}
} else if (col == PNG_COL_RGB) {
} else if (col == PNG_COLOR_RGB) {
if (dataSize != 6) return PNG_ERR_TRANS_COUNT;
res = Stream_Read(stream, tmp, dataSize);
if (res) return res;
@ -653,7 +653,7 @@ cc_result Png_Encode(struct Bitmap* bmp, struct Stream* stream,
Stream_SetU32_BE(&tmp[8], bmp->width);
Stream_SetU32_BE(&tmp[12], bmp->height);
tmp[16] = 8; /* bits per sample */
tmp[17] = alpha ? PNG_COL_RGB_A : PNG_COL_RGB;
tmp[17] = alpha ? PNG_COLOR_RGB_A : PNG_COLOR_RGB;
tmp[18] = 0; /* DEFLATE compression method */
tmp[19] = 0; /* ADAPTIVE filter method */
tmp[20] = 0; /* Not using interlacing */

View file

@ -189,7 +189,7 @@ void Gradient_Noise(struct Bitmap* bmp, BitmapCol col, int variation,
void Gradient_Vertical(struct Bitmap* bmp, BitmapCol a, BitmapCol b,
int x, int y, int width, int height) {
BitmapCol* row, col;
BitmapCol* row, color;
int xx, yy;
float t;
if (!Drawer2D_Clamp(bmp, &x, &y, &width, &height)) return;
@ -198,13 +198,13 @@ void Gradient_Vertical(struct Bitmap* bmp, BitmapCol a, BitmapCol b,
row = Bitmap_GetRow(bmp, y + yy) + x;
t = (float)yy / (height - 1); /* so last row has colour of b */
col = BitmapCol_Make(
color = BitmapCol_Make(
Math_Lerp(BitmapCol_R(a), BitmapCol_R(b), t),
Math_Lerp(BitmapCol_G(a), BitmapCol_G(b), t),
Math_Lerp(BitmapCol_B(a), BitmapCol_B(b), t),
255);
for (xx = 0; xx < width; xx++) { row[xx] = col; }
for (xx = 0; xx < width; xx++) { row[xx] = color; }
}
}
@ -239,7 +239,7 @@ void Gradient_Blend(struct Bitmap* bmp, BitmapCol col, int blend,
void Gradient_Tint(struct Bitmap* bmp, cc_uint8 tintA, cc_uint8 tintB,
int x, int y, int width, int height) {
BitmapCol* row, col;
BitmapCol* row, color;
cc_uint8 tint;
int xx, yy;
if (!Drawer2D_Clamp(bmp, &x, &y, &width, &height)) return;
@ -250,13 +250,13 @@ void Gradient_Tint(struct Bitmap* bmp, cc_uint8 tintA, cc_uint8 tintB,
for (xx = 0; xx < width; xx++) {
/* TODO: Not shift when multiplying */
col = BitmapCol_Make(
color = BitmapCol_Make(
BitmapCol_R(row[xx]) * tint / 255,
BitmapCol_G(row[xx]) * tint / 255,
BitmapCol_B(row[xx]) * tint / 255,
0);
row[xx] = col | (row[xx] & BITMAPCOL_A_MASK);
row[xx] = color | (row[xx] & BITMAPCOL_A_MASK);
}
}
}

View file

@ -226,8 +226,8 @@ cc_bool Entity_TouchesAnyWater(struct Entity* e) {
static void MakeNameTexture(struct Entity* e) {
cc_string colorlessName; char colorlessBuffer[STRING_SIZE];
BitmapCol shadowCol = BitmapCol_Make(80, 80, 80, 255);
BitmapCol origWhiteCol;
BitmapCol shadowColor = BitmapCol_Make(80, 80, 80, 255);
BitmapCol origWhiteColor;
struct DrawTextArgs args;
struct FontDesc font;
@ -254,14 +254,14 @@ static void MakeNameTexture(struct Entity* e) {
Bitmap_AllocateClearedPow2(&bmp, width, height);
{
origWhiteCol = Drawer2D.Colors['f'];
origWhiteColor = Drawer2D.Colors['f'];
Drawer2D.Colors['f'] = shadowCol;
Drawer2D.Colors['f'] = shadowColor;
Drawer2D_WithoutColors(&colorlessName, &name);
args.text = colorlessName;
Drawer2D_DrawText(&bmp, &args, NAME_OFFSET, NAME_OFFSET);
Drawer2D.Colors['f'] = origWhiteCol;
Drawer2D.Colors['f'] = origWhiteColor;
args.text = name;
Drawer2D_DrawText(&bmp, &args, 0, 0);
}

View file

@ -217,13 +217,13 @@ cc_bool Gfx_TryRestoreContext(void);
void Gfx_UpdateDynamicVb_IndexedTris(GfxResourceID vb, void* vertices, int vCount);
/* Renders a 2D flat coloured rectangle. */
void Gfx_Draw2DFlat(int x, int y, int width, int height, PackedCol col);
void Gfx_Draw2DFlat(int x, int y, int width, int height, PackedCol color);
/* Renders a 2D flat vertical gradient rectangle. */
void Gfx_Draw2DGradient(int x, int y, int width, int height, PackedCol top, PackedCol bottom);
/* Renders a 2D coloured texture. */
void Gfx_Draw2DTexture(const struct Texture* tex, PackedCol col);
void Gfx_Draw2DTexture(const struct Texture* tex, PackedCol color);
/* Fills out the vertices for rendering a 2D coloured texture. */
void Gfx_Make2DQuad(const struct Texture* tex, PackedCol col, struct VertexTextured** vertices);
void Gfx_Make2DQuad(const struct Texture* tex, PackedCol color, struct VertexTextured** vertices);
/* Switches state to be suitable for drawing 2D graphics. */
/* NOTE: This means turning off fog/depth test, changing matrices, etc.*/

View file

@ -150,20 +150,20 @@ static void LButton_DrawBorder(struct LButton* w) {
}
static void LButton_DrawHighlight(struct LButton* w) {
BitmapCol activeCol = BitmapCol_Make(189, 198, 255, 255);
BitmapCol col = Launcher_Theme.ButtonHighlightColor;
BitmapCol activeColor = BitmapCol_Make(189, 198, 255, 255);
BitmapCol color = Launcher_Theme.ButtonHighlightColor;
if (Launcher_Theme.ClassicBackground) {
if (w->hovered) col = activeCol;
if (w->hovered) color = activeColor;
Drawer2D_Clear(&Launcher_Framebuffer, col,
Drawer2D_Clear(&Launcher_Framebuffer, color,
w->x + xBorder2, w->y + yBorder,
w->width - xBorder4, yBorder);
Drawer2D_Clear(&Launcher_Framebuffer, col,
Drawer2D_Clear(&Launcher_Framebuffer, color,
w->x + xBorder, w->y + yBorder2,
xBorder, w->height - yBorder4);
} else if (!w->hovered) {
Drawer2D_Clear(&Launcher_Framebuffer, col,
Drawer2D_Clear(&Launcher_Framebuffer, color,
w->x + xBorder2, w->y + yBorder,
w->width - xBorder4, yBorder);
}
@ -269,10 +269,10 @@ void LBackend_DrawCheckbox(struct LCheckbox* w) {
*------------------------------------------------------InputWidget--------------------------------------------------------*
*#########################################################################################################################*/
static void LInput_DrawOuterBorder(struct LInput* w) {
BitmapCol col = BitmapCol_Make(97, 81, 110, 255);
BitmapCol color = BitmapCol_Make(97, 81, 110, 255);
if (w->selected) {
DrawBoxBounds(col, w->x, w->y, w->width, w->height);
DrawBoxBounds(color, w->x, w->y, w->width, w->height);
} else {
Launcher_ResetArea(w->x, w->y,
w->width, yBorder);
@ -286,32 +286,32 @@ static void LInput_DrawOuterBorder(struct LInput* w) {
}
static void LInput_DrawInnerBorder(struct LInput* w) {
BitmapCol col = BitmapCol_Make(165, 142, 168, 255);
BitmapCol color = BitmapCol_Make(165, 142, 168, 255);
Drawer2D_Clear(&Launcher_Framebuffer, col,
Drawer2D_Clear(&Launcher_Framebuffer, color,
w->x + xBorder, w->y + yBorder,
w->width - xBorder2, yBorder);
Drawer2D_Clear(&Launcher_Framebuffer, col,
Drawer2D_Clear(&Launcher_Framebuffer, color,
w->x + xBorder, w->y + w->height - yBorder2,
w->width - xBorder2, yBorder);
Drawer2D_Clear(&Launcher_Framebuffer, col,
Drawer2D_Clear(&Launcher_Framebuffer, color,
w->x + xBorder, w->y + yBorder,
xBorder, w->height - yBorder2);
Drawer2D_Clear(&Launcher_Framebuffer, col,
Drawer2D_Clear(&Launcher_Framebuffer, color,
w->x + w->width - xBorder2, w->y + yBorder,
xBorder, w->height - yBorder2);
}
static void LInput_BlendBoxTop(struct LInput* w) {
BitmapCol col = BitmapCol_Make(0, 0, 0, 255);
BitmapCol color = BitmapCol_Make(0, 0, 0, 255);
Gradient_Blend(&Launcher_Framebuffer, col, 75,
Gradient_Blend(&Launcher_Framebuffer, color, 75,
w->x + xBorder, w->y + yBorder,
w->width - xBorder2, yBorder);
Gradient_Blend(&Launcher_Framebuffer, col, 50,
Gradient_Blend(&Launcher_Framebuffer, color, 50,
w->x + xBorder, w->y + yBorder2,
w->width - xBorder2, yBorder);
Gradient_Blend(&Launcher_Framebuffer, col, 25,
Gradient_Blend(&Launcher_Framebuffer, color, 25,
w->x + xBorder, w->y + yBorder3,
w->width - xBorder2, yBorder);
}

View file

@ -1062,8 +1062,8 @@ static void CheckResourcesScreen_Layout(struct LScreen* s_) {
}
CC_NOINLINE static void CheckResourcesScreen_ResetArea(int x, int y, int width, int height) {
BitmapCol boxCol = BitmapCol_Make(120, 85, 151, 255);
Gradient_Noise(&Launcher_Framebuffer, boxCol, 4, x, y, width, height);
BitmapCol boxColor = BitmapCol_Make(120, 85, 151, 255);
Gradient_Noise(&Launcher_Framebuffer, boxColor, 4, x, y, width, height);
Launcher_MarkDirty(x, y, width, height);
}

View file

@ -640,10 +640,10 @@ static void LTable_SetSelectedTo(struct LTable* w, int index) {
/* Draws background behind column headers */
static void LTable_DrawHeaderBackground(struct LTable* w) {
BitmapCol gridCol = BitmapCol_Make(20, 20, 10, 255);
BitmapCol gridColor = BitmapCol_Make(20, 20, 10, 255);
if (!Launcher_Theme.ClassicBackground) {
Drawer2D_Clear(&Launcher_Framebuffer, gridCol,
Drawer2D_Clear(&Launcher_Framebuffer, gridColor,
w->x, w->y, w->width, w->hdrHeight);
} else {
Launcher_ResetArea(w->x, w->y, w->width, w->hdrHeight);
@ -652,9 +652,9 @@ static void LTable_DrawHeaderBackground(struct LTable* w) {
/* Works out the background colour of the given row */
static BitmapCol LTable_RowColor(struct LTable* w, int row) {
BitmapCol featSelCol = BitmapCol_Make( 50, 53, 0, 255);
BitmapCol featuredCol = BitmapCol_Make(101, 107, 0, 255);
BitmapCol selectedCol = BitmapCol_Make( 40, 40, 40, 255);
BitmapCol featSelColor = BitmapCol_Make( 50, 53, 0, 255);
BitmapCol featuredColor = BitmapCol_Make(101, 107, 0, 255);
BitmapCol selectedColor = BitmapCol_Make( 40, 40, 40, 255);
struct ServerInfo* entry;
cc_bool selected;
entry = row < w->rowsCount ? LTable_Get(row) : NULL;
@ -662,9 +662,9 @@ static BitmapCol LTable_RowColor(struct LTable* w, int row) {
if (entry) {
selected = String_Equals(&entry->hash, w->selectedHash);
if (entry->featured) {
return selected ? featSelCol : featuredCol;
return selected ? featSelColor : featuredColor;
} else if (selected) {
return selectedCol;
return selectedColor;
}
}

View file

@ -2450,14 +2450,14 @@ static void MenuOptionsScreen_Init(void* screen) {
static void MenuOptionsScreen_Render(void* screen, double delta) {
struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen;
struct TextGroupWidget* w;
PackedCol tableCol = PackedCol_Make(20, 20, 20, 200);
PackedCol tableColor = PackedCol_Make(20, 20, 20, 200);
MenuScreen_Render2(s, delta);
if (!s->extHelp.lines) return;
w = &s->extHelp;
Gfx_Draw2DFlat(w->x - EXTHELP_PAD, w->y - EXTHELP_PAD,
w->width + EXTHELP_PAD * 2, w->height + EXTHELP_PAD * 2, tableCol);
w->width + EXTHELP_PAD * 2, w->height + EXTHELP_PAD * 2, tableColor);
Gfx_SetTexturing(true);
Elem_Render(&s->extHelp, delta);

View file

@ -120,10 +120,10 @@ static void ButtonWidget_Reposition(void* widget) {
}
static void ButtonWidget_Render(void* widget, double delta) {
PackedCol normCol = PackedCol_Make(224, 224, 224, 255);
PackedCol activeCol = PackedCol_Make(255, 255, 160, 255);
PackedCol disabledCol = PackedCol_Make(160, 160, 160, 255);
PackedCol col;
PackedCol normColor = PackedCol_Make(224, 224, 224, 255);
PackedCol activeColor = PackedCol_Make(255, 255, 160, 255);
PackedCol disabledColor = PackedCol_Make(160, 160, 160, 255);
PackedCol color;
struct ButtonWidget* w = (struct ButtonWidget*)widget;
struct Texture back;
@ -155,15 +155,15 @@ static void ButtonWidget_Render(void* widget, double delta) {
}
if (!w->tex.ID) return;
col = w->disabled ? disabledCol : (w->active ? activeCol : normCol);
Texture_RenderShaded(&w->tex, col);
color = w->disabled ? disabledColor : (w->active ? activeColor : normColor);
Texture_RenderShaded(&w->tex, color);
}
static void ButtonWidget_BuildMesh(void* widget, struct VertexTextured** vertices) {
PackedCol normCol = PackedCol_Make(224, 224, 224, 255);
PackedCol activeCol = PackedCol_Make(255, 255, 160, 255);
PackedCol disabledCol = PackedCol_Make(160, 160, 160, 255);
PackedCol col;
PackedCol normColor = PackedCol_Make(224, 224, 224, 255);
PackedCol activeColor = PackedCol_Make(255, 255, 160, 255);
PackedCol disabledColor = PackedCol_Make(160, 160, 160, 255);
PackedCol color;
struct ButtonWidget* w = (struct ButtonWidget*)widget;
struct Texture back;
@ -192,8 +192,8 @@ static void ButtonWidget_BuildMesh(void* widget, struct VertexTextured** vertice
Gfx_Make2DQuad(&back, w->col, vertices);
}
col = w->disabled ? disabledCol : (w->active ? activeCol : normCol);
Gfx_Make2DQuad(&w->tex, col, vertices);
color = w->disabled ? disabledColor : (w->active ? activeColor : normColor);
Gfx_Make2DQuad(&w->tex, color, vertices);
}
static int ButtonWidget_Render2(void* widget, int offset) {
@ -749,13 +749,13 @@ static void TableWidget_Render(void* widget, double delta) {
/* These were sourced by taking a screenshot of vanilla */
/* Then using paint to extract the colour components */
/* Then using wolfram alpha to solve the glblendfunc equation */
PackedCol topBackCol = PackedCol_Make( 34, 34, 34, 168);
PackedCol bottomBackCol = PackedCol_Make( 57, 57, 104, 202);
PackedCol topSelCol = PackedCol_Make(255, 255, 255, 142);
PackedCol bottomSelCol = PackedCol_Make(255, 255, 255, 192);
PackedCol topBackColor = PackedCol_Make( 34, 34, 34, 168);
PackedCol bottomBackColor = PackedCol_Make( 57, 57, 104, 202);
PackedCol topSelColor = PackedCol_Make(255, 255, 255, 142);
PackedCol bottomSelColor = PackedCol_Make(255, 255, 255, 192);
Gfx_Draw2DGradient(Table_X(w), Table_Y(w),
Table_Width(w), Table_Height(w), topBackCol, bottomBackCol);
Table_Width(w), Table_Height(w), topBackColor, bottomBackColor);
if (w->rowsVisible < w->rowsTotal) {
Elem_Render(&w->scroll, delta);
@ -770,7 +770,7 @@ static void TableWidget_Render(void* widget, double delta) {
off = cellSizeX * 0.1f;
size = (int)(cellSizeX + off * 2);
Gfx_Draw2DGradient((int)(x - off), (int)(y - off),
size, size, topSelCol, bottomSelCol);
size, size, topSelColor, bottomSelColor);
}
Gfx_SetTexturing(true);
Gfx_SetVertexFormat(VERTEX_FORMAT_TEXTURED);
@ -1540,7 +1540,7 @@ static int TextInputWidget_Render2(void* widget, int offset) {
static void TextInputWidget_RemakeTexture(void* widget) {
cc_string range; char rangeBuffer[STRING_SIZE];
struct TextInputWidget* w = (struct TextInputWidget*)widget;
PackedCol backCol = PackedCol_Make(30, 30, 30, 200);
PackedCol backColor = PackedCol_Make(30, 30, 30, 200);
struct MenuInputDesc* desc;
struct DrawTextArgs args;
struct Texture* tex;
@ -1567,7 +1567,7 @@ static void TextInputWidget_RemakeTexture(void* widget) {
if (lineHeight < height) { y = height / 2 - lineHeight / 2; }
w->base.caretOffset = 2 + y;
Drawer2D_Clear(&bmp, backCol, 0, 0, width, height);
Drawer2D_Clear(&bmp, backColor, 0, 0, width, height);
Drawer2D_DrawText(&bmp, &args, w->base.padding, y);
args.text = range;
@ -1700,7 +1700,7 @@ static void ChatInputWidget_RemakeTexture(void* widget) {
static void ChatInputWidget_Render(void* widget, double delta) {
struct InputWidget* w = (struct InputWidget*)widget;
PackedCol backCol = PackedCol_Make(0, 0, 0, 127);
PackedCol backColor = PackedCol_Make(0, 0, 0, 127);
int x = w->x, y = w->y;
cc_bool caretAtEnd;
int i, width;
@ -1714,7 +1714,7 @@ static void ChatInputWidget_Render(void* widget, double delta) {
/* Cover whole window width to match original classic behaviour */
if (Gui.ClassicChat) { width = max(width, WindowInfo.Width - x * 4); }
Gfx_Draw2DFlat(x, y, width + w->padding * 2, w->lineHeight, backCol);
Gfx_Draw2DFlat(x, y, width + w->padding * 2, w->lineHeight, backColor);
y += w->lineHeight;
}
@ -2394,19 +2394,19 @@ static int SpecialInputWidget_MeasureTitles(struct SpecialInputWidget* w) {
}
static void SpecialInputWidget_DrawTitles(struct SpecialInputWidget* w, struct Bitmap* bmp) {
BitmapCol col_selected = BitmapCol_Make(30, 30, 30, 200);
BitmapCol col_inactive = BitmapCol_Make( 0, 0, 0, 127);
BitmapCol col;
BitmapCol color_selected = BitmapCol_Make(30, 30, 30, 200);
BitmapCol color_inactive = BitmapCol_Make( 0, 0, 0, 127);
BitmapCol color;
struct DrawTextArgs args;
int i, width, x = 0;
DrawTextArgs_MakeEmpty(&args, w->font, false);
for (i = 0; i < Array_Elems(w->tabs); i++) {
args.text = w->tabs[i].title;
col = i == w->selectedIndex ? col_selected : col_inactive;
color = i == w->selectedIndex ? color_selected : color_inactive;
width = w->tabs[i].titleWidth;
Drawer2D_Clear(bmp, col, x, 0, width, w->titleHeight);
Drawer2D_Clear(bmp, color, x, 0, width, w->titleHeight);
Drawer2D_DrawText(bmp, &args, x + SPECIAL_TITLE_SPACING / 2, 0);
x += width;
}

View file

@ -113,14 +113,14 @@ void Gfx_UpdateDynamicVb_IndexedTris(GfxResourceID vb, void* vertices, int vCoun
Gfx_DrawVb_IndexedTris(vCount);
}
void Gfx_Draw2DFlat(int x, int y, int width, int height, PackedCol col) {
void Gfx_Draw2DFlat(int x, int y, int width, int height, PackedCol color) {
struct VertexColoured verts[4];
struct VertexColoured* v = verts;
v->X = (float)x; v->Y = (float)y; v->Z = 0; v->Col = col; v++;
v->X = (float)(x + width); v->Y = (float)y; v->Z = 0; v->Col = col; v++;
v->X = (float)(x + width); v->Y = (float)(y + height); v->Z = 0; v->Col = col; v++;
v->X = (float)x; v->Y = (float)(y + height); v->Z = 0; v->Col = col; v++;
v->X = (float)x; v->Y = (float)y; v->Z = 0; v->Col = color; v++;
v->X = (float)(x + width); v->Y = (float)y; v->Z = 0; v->Col = color; v++;
v->X = (float)(x + width); v->Y = (float)(y + height); v->Z = 0; v->Col = color; v++;
v->X = (float)x; v->Y = (float)(y + height); v->Z = 0; v->Col = color; v++;
Gfx_SetVertexFormat(VERTEX_FORMAT_COLOURED);
Gfx_UpdateDynamicVb_IndexedTris(Gfx_quadVb, verts, 4);
@ -139,15 +139,15 @@ void Gfx_Draw2DGradient(int x, int y, int width, int height, PackedCol top, Pack
Gfx_UpdateDynamicVb_IndexedTris(Gfx_quadVb, verts, 4);
}
void Gfx_Draw2DTexture(const struct Texture* tex, PackedCol col) {
void Gfx_Draw2DTexture(const struct Texture* tex, PackedCol color) {
struct VertexTextured texVerts[4];
struct VertexTextured* ptr = texVerts;
Gfx_Make2DQuad(tex, col, &ptr);
Gfx_Make2DQuad(tex, color, &ptr);
Gfx_SetVertexFormat(VERTEX_FORMAT_TEXTURED);
Gfx_UpdateDynamicVb_IndexedTris(Gfx_texVb, texVerts, 4);
}
void Gfx_Make2DQuad(const struct Texture* tex, PackedCol col, struct VertexTextured** vertices) {
void Gfx_Make2DQuad(const struct Texture* tex, PackedCol color, struct VertexTextured** vertices) {
float x1 = (float)tex->X, x2 = (float)(tex->X + tex->Width);
float y1 = (float)tex->Y, y2 = (float)(tex->Y + tex->Height);
struct VertexTextured* v = *vertices;
@ -159,10 +159,10 @@ void Gfx_Make2DQuad(const struct Texture* tex, PackedCol col, struct VertexTextu
y1 -= 0.5f; y2 -= 0.5f;
#endif
v->X = x1; v->Y = y1; v->Z = 0; v->Col = col; v->U = tex->uv.U1; v->V = tex->uv.V1; v++;
v->X = x2; v->Y = y1; v->Z = 0; v->Col = col; v->U = tex->uv.U2; v->V = tex->uv.V1; v++;
v->X = x2; v->Y = y2; v->Z = 0; v->Col = col; v->U = tex->uv.U2; v->V = tex->uv.V2; v++;
v->X = x1; v->Y = y2; v->Z = 0; v->Col = col; v->U = tex->uv.U1; v->V = tex->uv.V2; v++;
v->X = x1; v->Y = y1; v->Z = 0; v->Col = color; v->U = tex->uv.U1; v->V = tex->uv.V1; v++;
v->X = x2; v->Y = y1; v->Z = 0; v->Col = color; v->U = tex->uv.U2; v->V = tex->uv.V1; v++;
v->X = x2; v->Y = y2; v->Z = 0; v->Col = color; v->U = tex->uv.U2; v->V = tex->uv.V2; v++;
v->X = x1; v->Y = y2; v->Z = 0; v->Col = color; v->U = tex->uv.U1; v->V = tex->uv.V2; v++;
*vertices = v;
}