No description
- TeX 100%
| .vscode | Add basic frames structs, imports and sync unit | |
| imports/root | add root dir, move import files to root dir | |
| scripts | bump version, fix bug with incorrect ToBin converting | |
| units | move mostly needed parts of system to ZINC | |
| library.json | bump version, fix bug with incorrect ToBin converting | |
| LICENSE | Initial commit | |
| README.md | move mostly needed parts of system to ZINC | |
kw-mh-frames - Frames lib for Unryze Memhack
Examples
Connect click to function
scope clickConnection initializer init
globals
public unit clickUnit = null // This unit will be used in frames for SyncChoose(unit, player)
endglobals
public function testFunc takes nothing returns nothing
local integer id = getSyncId() // Id of clicked element
local player p = getSyncPlayer() // Player which click on element
call BJDebugMsg(I2S(id))
call BJDebugMsg(I2S(GetPlayerId(p)))
endfunction
private function init takes nothing returns nothing
set clickUnit = makeEndSyncUnitForFunction("clickConnection_testFunc") // This function will be executed with ExecuteFunc(string)
endfunction
endscope
Simple button
scope simpleButtonUI
struct simpleButtonUI extends uiElement
integer clickId = 12 // Supported only numbers from 0 to 255
Icon icon
Button btn
boolean isHovering = true
method onUIInit takes nothing returns nothing
local string texture = "ReplaceableTextures\\CommandButtons\\"
local Vector2 size = Vector2.fromXY(.075, .075)
local Vector2 pos = Vector2.fromXY(.005, .0125)
set icon = Icon.make("Icon" + I2S(clickId), pGameUI, texture, pos, size)
set btn = Button.make("Button|" + I2S(clickId), pGameUI, texture, pos, size)
call icon.show()
call btn.show()
endmethod
method onClick takes nothing returns nothing
local integer pid = libCustomUi_mousePlayerId
call SyncChoose(clickId, clickConnection_clickUnit) // Use sync with clickedId and clickUnit
endmethod
method isHovered takes nothing returns boolean
return this.isHovering and FindCLayerUnderCursor() == btn.frame
endmethod
method show takes nothing returns nothing
call btn.show()
call icon.show()
endmethod
method hide takes nothing returns nothing
call btn.hide()
call icon.hide()
endmethod
implement staticModuleUI
private static method onInit takes nothing returns nothing
call simpleButtonUI.make("simpleButton")
endmethod
endstruct
endscope
New examples (not ready yet)
Create Button with click and hover actions on ZINC
library testTextUI requires frameTextStruct {
private function onInit() {
FrameText text = FrameText.make(
"Test text, trololo",
Vector2.fromXY(.005, .0125),
function () { // onPeriodic
FrameText text = FrameText.getCurrent();
});
}
}