diff --git a/libstarlight/source/starlight/gfx/RenderCore.cpp b/libstarlight/source/starlight/gfx/RenderCore.cpp index cf3992c..0ee7149 100644 --- a/libstarlight/source/starlight/gfx/RenderCore.cpp +++ b/libstarlight/source/starlight/gfx/RenderCore.cpp @@ -152,8 +152,9 @@ void RenderCore::EndFrame() { namespace { void ApplyBlendMode(C3D_TexEnv* env, BlendMode mode) { switch(mode) { - case BlendMode::Mask: // TODO: actually implement masking! this is just a copy of Blend right now - C3D_TexEnvOp(env, C3D_RGB, 0, 0, 0); + case BlendMode::Mask: // multiplies the buffer contents by the mask texture + C3D_AlphaBlend(GPU_BLEND_ADD, GPU_BLEND_ADD, GPU_ZERO, GPU_SRC_COLOR, GPU_ZERO, GPU_SRC_ALPHA); // zero + (buffer * texel) + C3D_TexEnvOp(env, C3D_RGB, 0, 0, 0); // and the rest is the same as blend C3D_TexEnvOp(env, C3D_Alpha, GPU_TEVOP_A_SRC_ALPHA, GPU_TEVOP_A_SRC_ALPHA, 0); C3D_TexEnvFunc(env, C3D_RGB, GPU_MODULATE); C3D_TexEnvFunc(env, C3D_Alpha, GPU_MODULATE); diff --git a/libstarlight/source/starlight/ui/Label.cpp b/libstarlight/source/starlight/ui/Label.cpp index a70e437..ce91988 100644 --- a/libstarlight/source/starlight/ui/Label.cpp +++ b/libstarlight/source/starlight/ui/Label.cpp @@ -54,6 +54,10 @@ void Label::PreDraw() { buffer->Clear(); GFXManager::PushContext(buffer.get()); textConfig.ROGet().Print(buffer->rect, text); + static auto testmask = + //ThemeManager::GetAsset("controls/button.idle"); + ThemeManager::GetAsset("decorations/testmask"); + testmask->Draw(buffer->rect, nullptr, nullptr, gfx::BlendMode::Mask); GFXManager::PopContext(); } } diff --git a/libstarlight/todo.txt b/libstarlight/todo.txt index ae5d78b..c1a1fcf 100644 --- a/libstarlight/todo.txt +++ b/libstarlight/todo.txt @@ -8,7 +8,7 @@ roadmap to v0.5.1 { https://github.com/citra-emu/citra/issues/2684 implement more blend modes { - flat replace - masking + - masking } - fix the hang on osk when pressing (L|R)+up+left @@ -28,6 +28,7 @@ roadmap to v0.5.1 { Trackable sideclass for threads; float progress 0..1, etc. - MAKE THREADS END CLEANLY ^ observed a single instance of being stalled on redscreen, not really sure what that was about + lambda task thread } } then by v0.5.5 { event propagation system of some sort; threadsafe to whatever extent is needed on 3DS diff --git a/themes/default/decorations/testmask.png b/themes/default/decorations/testmask.png new file mode 100644 index 0000000..bc5d6e2 Binary files /dev/null and b/themes/default/decorations/testmask.png differ