backlog update
This commit is contained in:
+72
-63
@@ -23,6 +23,7 @@ using namespace wi::graphics;
|
||||
namespace wi::backlog
|
||||
{
|
||||
bool enabled = false;
|
||||
bool was_ever_enabled = enabled;
|
||||
struct LogEntry
|
||||
{
|
||||
std::string text;
|
||||
@@ -75,6 +76,7 @@ namespace wi::backlog
|
||||
void Toggle()
|
||||
{
|
||||
enabled = !enabled;
|
||||
was_ever_enabled = true;
|
||||
}
|
||||
void Scroll(float dir)
|
||||
{
|
||||
@@ -202,71 +204,78 @@ namespace wi::backlog
|
||||
ColorSpace colorspace
|
||||
)
|
||||
{
|
||||
if (pos > -canvas.GetLogicalHeight())
|
||||
if (!was_ever_enabled)
|
||||
return;
|
||||
if (pos <= -canvas.GetLogicalHeight())
|
||||
return;
|
||||
|
||||
GraphicsDevice* device = GetDevice();
|
||||
device->EventBegin("Backlog", cmd);
|
||||
|
||||
if (!backgroundTex.IsValid())
|
||||
{
|
||||
if (!backgroundTex.IsValid())
|
||||
{
|
||||
const uint8_t colorData[] = { 0, 0, 43, 200, 43, 31, 141, 223 };
|
||||
wi::texturehelper::CreateTexture(backgroundTex, colorData, 1, 2);
|
||||
}
|
||||
|
||||
wi::image::Params fx = wi::image::Params((float)canvas.GetLogicalWidth(), (float)canvas.GetLogicalHeight());
|
||||
fx.pos = XMFLOAT3(0, pos, 0);
|
||||
fx.opacity = wi::math::Lerp(1, 0, -pos / canvas.GetLogicalHeight());
|
||||
if (colorspace != ColorSpace::SRGB)
|
||||
{
|
||||
fx.enableLinearOutputMapping(9);
|
||||
}
|
||||
wi::image::Draw(&backgroundTex, fx, cmd);
|
||||
|
||||
wi::image::Params inputbg;
|
||||
inputbg.color = wi::Color(80, 140, 180, 200);
|
||||
inputbg.pos = inputField.translation;
|
||||
inputbg.pos.x -= 8;
|
||||
inputbg.pos.y -= 8;
|
||||
inputbg.siz = inputField.GetSize();
|
||||
inputbg.siz.x += 16;
|
||||
inputbg.siz.y += 16;
|
||||
inputbg.enableCornerRounding();
|
||||
inputbg.corners_rounding[0].radius = 10;
|
||||
inputbg.corners_rounding[1].radius = 10;
|
||||
inputbg.corners_rounding[2].radius = 10;
|
||||
inputbg.corners_rounding[3].radius = 10;
|
||||
if (colorspace != ColorSpace::SRGB)
|
||||
{
|
||||
inputbg.enableLinearOutputMapping(9);
|
||||
}
|
||||
wi::image::Draw(wi::texturehelper::getWhite(), inputbg, cmd);
|
||||
|
||||
if (colorspace != ColorSpace::SRGB)
|
||||
{
|
||||
inputField.sprites[inputField.GetState()].params.enableLinearOutputMapping(9);
|
||||
inputField.font.params.enableLinearOutputMapping(9);
|
||||
toggleButton.sprites[inputField.GetState()].params.enableLinearOutputMapping(9);
|
||||
toggleButton.font.params.enableLinearOutputMapping(9);
|
||||
}
|
||||
inputField.Render(canvas, cmd);
|
||||
|
||||
Rect rect;
|
||||
rect.left = 0;
|
||||
rect.right = (int32_t)canvas.GetPhysicalWidth();
|
||||
rect.top = 0;
|
||||
rect.bottom = (int32_t)canvas.GetPhysicalHeight();
|
||||
wi::graphics::GetDevice()->BindScissorRects(1, &rect, cmd);
|
||||
|
||||
toggleButton.Render(canvas, cmd);
|
||||
|
||||
rect.bottom = int32_t(canvas.LogicalToPhysical(inputField.GetPos().y - 15));
|
||||
wi::graphics::GetDevice()->BindScissorRects(1, &rect, cmd);
|
||||
|
||||
DrawOutputText(canvas, cmd, colorspace);
|
||||
|
||||
rect.left = 0;
|
||||
rect.right = std::numeric_limits<int>::max();
|
||||
rect.top = 0;
|
||||
rect.bottom = std::numeric_limits<int>::max();
|
||||
wi::graphics::GetDevice()->BindScissorRects(1, &rect, cmd);
|
||||
const uint8_t colorData[] = { 0, 0, 43, 200, 43, 31, 141, 223 };
|
||||
wi::texturehelper::CreateTexture(backgroundTex, colorData, 1, 2);
|
||||
device->SetName(&backgroundTex, "wi::backlog::backgroundTex");
|
||||
}
|
||||
|
||||
wi::image::Params fx = wi::image::Params((float)canvas.GetLogicalWidth(), (float)canvas.GetLogicalHeight());
|
||||
fx.pos = XMFLOAT3(0, pos, 0);
|
||||
fx.opacity = wi::math::Lerp(1, 0, -pos / canvas.GetLogicalHeight());
|
||||
if (colorspace != ColorSpace::SRGB)
|
||||
{
|
||||
fx.enableLinearOutputMapping(9);
|
||||
}
|
||||
wi::image::Draw(&backgroundTex, fx, cmd);
|
||||
|
||||
wi::image::Params inputbg;
|
||||
inputbg.color = wi::Color(80, 140, 180, 200);
|
||||
inputbg.pos = inputField.translation;
|
||||
inputbg.pos.x -= 8;
|
||||
inputbg.pos.y -= 8;
|
||||
inputbg.siz = inputField.GetSize();
|
||||
inputbg.siz.x += 16;
|
||||
inputbg.siz.y += 16;
|
||||
inputbg.enableCornerRounding();
|
||||
inputbg.corners_rounding[0].radius = 10;
|
||||
inputbg.corners_rounding[1].radius = 10;
|
||||
inputbg.corners_rounding[2].radius = 10;
|
||||
inputbg.corners_rounding[3].radius = 10;
|
||||
if (colorspace != ColorSpace::SRGB)
|
||||
{
|
||||
inputbg.enableLinearOutputMapping(9);
|
||||
}
|
||||
wi::image::Draw(wi::texturehelper::getWhite(), inputbg, cmd);
|
||||
|
||||
if (colorspace != ColorSpace::SRGB)
|
||||
{
|
||||
inputField.sprites[inputField.GetState()].params.enableLinearOutputMapping(9);
|
||||
inputField.font.params.enableLinearOutputMapping(9);
|
||||
toggleButton.sprites[inputField.GetState()].params.enableLinearOutputMapping(9);
|
||||
toggleButton.font.params.enableLinearOutputMapping(9);
|
||||
}
|
||||
inputField.Render(canvas, cmd);
|
||||
|
||||
Rect rect;
|
||||
rect.left = 0;
|
||||
rect.right = (int32_t)canvas.GetPhysicalWidth();
|
||||
rect.top = 0;
|
||||
rect.bottom = (int32_t)canvas.GetPhysicalHeight();
|
||||
device->BindScissorRects(1, &rect, cmd);
|
||||
|
||||
toggleButton.Render(canvas, cmd);
|
||||
|
||||
rect.bottom = int32_t(canvas.LogicalToPhysical(inputField.GetPos().y - 15));
|
||||
device->BindScissorRects(1, &rect, cmd);
|
||||
|
||||
DrawOutputText(canvas, cmd, colorspace);
|
||||
|
||||
rect.left = 0;
|
||||
rect.right = std::numeric_limits<int>::max();
|
||||
rect.top = 0;
|
||||
rect.bottom = std::numeric_limits<int>::max();
|
||||
device->BindScissorRects(1, &rect, cmd);
|
||||
device->EventEnd(cmd);
|
||||
}
|
||||
|
||||
void DrawOutputText(
|
||||
|
||||
@@ -463,6 +463,7 @@ namespace wi::font
|
||||
|
||||
// Upload the CPU-side texture atlas bitmap to the GPU:
|
||||
wi::texturehelper::CreateTexture(texture, atlas.data(), atlasWidth, atlasHeight, Format::R8_UNORM);
|
||||
GetDevice()->SetName(&texture, "wi::font::texture");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wi::version
|
||||
// minor features, major updates, breaking compatibility changes
|
||||
const int minor = 71;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 272;
|
||||
const int revision = 273;
|
||||
|
||||
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
|
||||
|
||||
@@ -133,6 +133,8 @@ Patreon supporters
|
||||
- Segfault
|
||||
- Mike amanfo
|
||||
- Dennis Brakhane
|
||||
- rookie
|
||||
- Peter Moore
|
||||
)";
|
||||
|
||||
return credits;
|
||||
|
||||
Reference in New Issue
Block a user