mirror of
				https://github.com/thunderbrewhq/thunderbrew
				synced 2025-10-31 00:06:05 +03:00 
			
		
		
		
	chore(ui): add CSimpleFrame_SetBackdropColor and CSimpleFrame_SetBackdropBorderColor
This commit is contained in:
		
							parent
							
								
									b6ee76054f
								
							
						
					
					
						commit
						03804e0ff4
					
				| @ -110,7 +110,7 @@ int32_t RealmConnection::HandleAuthChallenge(AuthenticationChallenge* challenge) | ||||
|     // TODO switch to WDataStore
 | ||||
|     CDataStore msg; | ||||
| 
 | ||||
|     uint32_t localChallenge; | ||||
|     uint32_t localChallenge = 0; | ||||
| 
 | ||||
|     msg.Put(static_cast<uint32_t>(CMSG_AUTH_SESSION)); | ||||
| 
 | ||||
|  | ||||
| @ -152,6 +152,13 @@ void CBackdropGenerator::LoadXML(XMLNode* node, CStatus* status) { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void CBackdropGenerator::SetVertexColor(const CImVector& color) { | ||||
|     this->m_color = color; | ||||
|     if (this->m_backgroundTexture) { | ||||
|         this->m_backgroundTexture->SetVertexColor(color); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void CBackdropGenerator::SetBorderVertexColor(const CImVector& borderColor) { | ||||
|     this->m_borderColor = borderColor; | ||||
| 
 | ||||
|  | ||||
| @ -42,6 +42,7 @@ class CBackdropGenerator { | ||||
|         CBackdropGenerator(); | ||||
|         void Generate(const CRect* rect); | ||||
|         void LoadXML(XMLNode* node, CStatus* status); | ||||
|         void SetVertexColor(const CImVector& color); | ||||
|         void SetBorderVertexColor(const CImVector& borderColor); | ||||
|         void SetOutput(CSimpleFrame* frame); | ||||
| }; | ||||
|  | ||||
| @ -1327,7 +1327,19 @@ void CSimpleFrame::SetBeingScrolled(int32_t a2, int32_t a3) { | ||||
| } | ||||
| 
 | ||||
| void CSimpleFrame::SetFrameAlpha(uint8_t alpha) { | ||||
|     // TODO
 | ||||
|     if (this->m_alpha == alpha) { | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     this->m_alpha = alpha; | ||||
| 
 | ||||
|     for (auto region = this->m_regions.Head(); region; region = this->m_regions.Link(region)->Next()) { | ||||
|         region->OnColorChanged(true); | ||||
|     } | ||||
| 
 | ||||
|     for (auto child = this->m_children.Head(); child; child = this->m_children.Link(child)->Next()) { | ||||
|         child->frame->SetFrameAlpha(alpha); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void CSimpleFrame::SetFrameFlag(int32_t flag, int32_t on) { | ||||
|  | ||||
| @ -37,6 +37,7 @@ class CSimpleFrame : public CScriptRegion { | ||||
|         float m_depth = 0.0; | ||||
|         FRAME_STRATA m_strata = FRAME_STRATA_MEDIUM; | ||||
|         int32_t m_level = 0; | ||||
|         uint8_t m_alpha = 255; | ||||
|         uint32_t m_eventmask = 0; | ||||
|         int32_t m_shown = 0; | ||||
|         int32_t m_visible = 0; | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| #include "gx/Coordinate.hpp" | ||||
| #include "ui/CSimpleFrame.hpp" | ||||
| #include "ui/FrameScript.hpp" | ||||
| #include "ui/CBackdropGenerator.hpp" | ||||
| #include "util/Lua.hpp" | ||||
| #include "util/Unimplemented.hpp" | ||||
| #include <algorithm> | ||||
| @ -460,7 +461,26 @@ int32_t CSimpleFrame_GetBackdropColor(lua_State* L) { | ||||
| } | ||||
| 
 | ||||
| int32_t CSimpleFrame_SetBackdropColor(lua_State* L) { | ||||
|     WHOA_UNIMPLEMENTED(0); | ||||
|     if (lua_type(L, 1) != LUA_TTABLE) { | ||||
|         luaL_error(L, "Attempt to find 'this' in non-table object (used '.' instead of ':' ?)"); | ||||
|     } | ||||
| 
 | ||||
|     lua_rawgeti(L, 1, 0); | ||||
|     auto object = reinterpret_cast<CSimpleFrame*>(lua_touserdata(L, -1)); | ||||
|     lua_settop(L, -2); | ||||
| 
 | ||||
|     STORM_ASSERT(object); | ||||
| 
 | ||||
|     CImVector color; | ||||
|     auto red = lua_tonumber(L, 2); | ||||
|     auto green = lua_tonumber(L, 3); | ||||
|     auto blue = lua_tonumber(L, 4); | ||||
|     auto alpha = lua_isnumber(L, 5)  ? lua_tonumber(L, 5) : 1.0; | ||||
|     color.Set(alpha, red, green, blue); | ||||
| 
 | ||||
|     if (object->m_backdrop) { | ||||
|         object->m_backdrop->SetVertexColor(color); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| int32_t CSimpleFrame_GetBackdropBorderColor(lua_State* L) { | ||||
| @ -468,7 +488,26 @@ int32_t CSimpleFrame_GetBackdropBorderColor(lua_State* L) { | ||||
| } | ||||
| 
 | ||||
| int32_t CSimpleFrame_SetBackdropBorderColor(lua_State* L) { | ||||
|     WHOA_UNIMPLEMENTED(0); | ||||
|     if (lua_type(L, 1) != LUA_TTABLE) { | ||||
|         luaL_error(L, "Attempt to find 'this' in non-table object (used '.' instead of ':' ?)"); | ||||
|     } | ||||
| 
 | ||||
|     lua_rawgeti(L, 1, 0); | ||||
|     auto object = reinterpret_cast<CSimpleFrame*>(lua_touserdata(L, -1)); | ||||
|     lua_settop(L, -2); | ||||
| 
 | ||||
|     STORM_ASSERT(object); | ||||
| 
 | ||||
|     CImVector color; | ||||
|     auto red = lua_tonumber(L, 2); | ||||
|     auto green = lua_tonumber(L, 3); | ||||
|     auto blue = lua_tonumber(L, 4); | ||||
|     auto alpha = lua_isnumber(L, 5) ? lua_tonumber(L, 5) : 1.0; | ||||
|     color.Set(alpha, red, green, blue); | ||||
| 
 | ||||
|     if (object->m_backdrop) { | ||||
|         object->m_backdrop->SetBorderVertexColor(color); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| int32_t CSimpleFrame_SetDepth(lua_State* L) { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 VDm
						VDm