mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 13:41:06 +03:00
feat(ui): implement CScriptRegion_SetSize
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
This commit is contained in:
parent
91da4e9680
commit
66df4c55da
@ -219,7 +219,28 @@ int32_t CScriptRegion_SetHeight(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CScriptRegion_SetSize(lua_State* L) {
|
int32_t CScriptRegion_SetSize(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto type = CScriptRegion::GetObjectType();
|
||||||
|
auto region = static_cast<CScriptRegion*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
if (!region->ProtectedFunctionsAllowed()) {
|
||||||
|
// TODO disallowed logic
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lua_isnumber(L, 2) || !lua_isnumber(L, 3)) {
|
||||||
|
luaL_error(L, "Usage: %s:SetSize(width, height)", region->GetDisplayName());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ndcWidth = static_cast<float>(lua_tonumber(L, 2)) / (CoordinateGetAspectCompensation() * 1024.0f);
|
||||||
|
auto ddcWidth = NDCToDDCWidth(ndcWidth);
|
||||||
|
|
||||||
|
auto ndcHeight = static_cast<float>(lua_tonumber(L, 3)) / (CoordinateGetAspectCompensation() * 1024.0f);
|
||||||
|
auto ddcHeight = NDCToDDCWidth(ndcHeight);
|
||||||
|
|
||||||
|
region->SetSize(ddcWidth, ddcHeight);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CScriptRegion_GetSize(lua_State* L) {
|
int32_t CScriptRegion_GetSize(lua_State* L) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user