mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Added 'DarkTheme.png' theme image with encoded colors
This commit is contained in:
parent
4f2472c276
commit
287922693e
11 changed files with 93 additions and 14 deletions
|
@ -154,5 +154,10 @@ namespace Beefy.gfx
|
|||
{
|
||||
return (color & 0xFF00FF00) | ((color & 0x00FF0000) >> 16) | ((color & 0x000000FF) << 16);
|
||||
}
|
||||
|
||||
public static uint32 FromNative(Color color)
|
||||
{
|
||||
return (color & 0xFF00FF00) | ((color & 0x00FF0000) >> 16) | ((color & 0x000000FF) << 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,15 @@ namespace Beefy.gfx
|
|||
{
|
||||
#if !STUDIO_CLIENT
|
||||
public class Image : IDrawable
|
||||
{
|
||||
{
|
||||
enum LoadFlags
|
||||
{
|
||||
None = 0,
|
||||
Additive = 1,
|
||||
NoPremult = 2,
|
||||
AllowRead = 4
|
||||
}
|
||||
|
||||
public Image mSrcTexture;
|
||||
public int32 mSrcX;
|
||||
public int32 mSrcY;
|
||||
|
@ -29,7 +37,7 @@ namespace Beefy.gfx
|
|||
public static extern void Gfx_DrawTextureSegment(void* textureSegment, float a, float b, float c, float d, float tx, float ty, float z, uint32 color, int32 pixelSnapping);
|
||||
|
||||
[StdCall, CLink]
|
||||
static extern void* Gfx_LoadTexture(char8* fileName, int32 additive);
|
||||
static extern void* Gfx_LoadTexture(char8* fileName, int32 flags);
|
||||
|
||||
[StdCall, CLink]
|
||||
static extern void* Gfx_CreateDynTexture(int32 width, int32 height);
|
||||
|
@ -49,6 +57,9 @@ namespace Beefy.gfx
|
|||
[StdCall, CLink]
|
||||
static extern void Gfx_Texture_SetBits(void* textureSegment, int32 destX, int32 destY, int32 destWidth, int32 destHeight, int32 srcPitch, uint32* bits);
|
||||
|
||||
[StdCall, CLink]
|
||||
static extern void Gfx_Texture_GetBits(void* textureSegment, int32 srcX, int32 srcY, int32 srcWidth, int32 srcHeight, int32 destPitch, uint32* bits);
|
||||
|
||||
[StdCall, CLink]
|
||||
static extern void Gfx_Texture_Delete(void* textureSegment);
|
||||
|
||||
|
@ -82,11 +93,11 @@ namespace Beefy.gfx
|
|||
return CreateFromNativeTextureSegment(aNativeTextureSegment);
|
||||
}
|
||||
|
||||
public static Image LoadFromFile(String fileName, bool additive = false)
|
||||
public static Image LoadFromFile(String fileName, LoadFlags flags = .None)
|
||||
{
|
||||
scope AutoBeefPerf("Image.LoadFromFile");
|
||||
|
||||
void* aNativeTextureSegment = Gfx_LoadTexture(fileName, additive ? 1 : 0);
|
||||
void* aNativeTextureSegment = Gfx_LoadTexture(fileName, (int32)flags);
|
||||
if (aNativeTextureSegment == null)
|
||||
return null;
|
||||
|
||||
|
@ -175,6 +186,11 @@ namespace Beefy.gfx
|
|||
Gfx_Texture_SetBits(mNativeTextureSegment, (.)destX, (.)destY, (.)destWidth, (.)destHeight, (.)srcPitch, bits);
|
||||
}
|
||||
|
||||
public void GetBits(int srcX, int srcY, int srcWidth, int srcHeight, int destPitch, uint32* bits)
|
||||
{
|
||||
Gfx_Texture_GetBits(mNativeTextureSegment, (.)srcX, (.)srcY, (.)srcWidth, (.)srcHeight, (.)destPitch, bits);
|
||||
}
|
||||
|
||||
public void CreateImageCels(Image[,] celImages)
|
||||
{
|
||||
int32 rows = (int32)celImages.GetLength(0);
|
||||
|
|
|
@ -183,13 +183,11 @@ namespace Beefy.theme.dark
|
|||
COUNT
|
||||
};
|
||||
|
||||
public const uint32 COLOR_WINDOW = 0xFF595959;
|
||||
public const uint32 COLOR_BKG = 0xFF262626;
|
||||
public const uint32 COLOR_SELECTED_OUTLINE = 0xFFE6A800;
|
||||
public const uint32 COLOR_MENU_FOCUSED = 0xFFFFA000;
|
||||
public const uint32 COLOR_MENU_SELECTED = 0xFFD0A070;
|
||||
public const uint32 COLOR_TIMELINE_SEP = 0xFF202020;
|
||||
public const uint32 COLOR_TIMELINE_RULE = 0xFF4A4A4A;
|
||||
public static uint32 COLOR_WINDOW = 0xFF595959;
|
||||
public static uint32 COLOR_BKG = 0xFF262626;
|
||||
public static uint32 COLOR_SELECTED_OUTLINE = 0xFFE6A800;
|
||||
public static uint32 COLOR_MENU_FOCUSED = 0xFFFFA000;
|
||||
public static uint32 COLOR_MENU_SELECTED = 0xFFD0A070;
|
||||
|
||||
public static float sScale = 1.0f;
|
||||
public static int32 sSrcImgScale = 1;
|
||||
|
@ -309,6 +307,16 @@ namespace Beefy.theme.dark
|
|||
delete mWindowTopImage;
|
||||
}
|
||||
|
||||
Image themeImg = Image.LoadFromFile(scope String..Append(tempStr, BFApp.sApp.mInstallDir, "images/DarkTheme.png"), .AllowRead);
|
||||
defer delete themeImg;
|
||||
uint32[5] bits = ?;
|
||||
themeImg.GetBits(0, 0, bits.Count, 1, bits.Count, &bits);
|
||||
COLOR_WINDOW = Color.FromNative(bits[0]);
|
||||
COLOR_BKG = Color.FromNative(bits[1]);
|
||||
COLOR_SELECTED_OUTLINE = Color.FromNative(bits[2]);
|
||||
COLOR_MENU_FOCUSED = Color.FromNative(bits[3]);
|
||||
COLOR_MENU_SELECTED = Color.FromNative(bits[4]);
|
||||
|
||||
String uiFileName = null;
|
||||
switch (sSrcImgScale)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue