Skip to content

Commit

Permalink
add HideHUD mod source
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMorc committed Oct 13, 2021
1 parent b33b821 commit 70243b3
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
71 changes: 71 additions & 0 deletions HideHUD/hidehud.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
-- HideHUD Mod - hidehud.lua
-- possibly the only file needed for it all
-- @author Richard Gráčik (mailto:[email protected])
-- @date 13.10.2021

print("[HideHUD Mod] saving original draw and keyEvent functions")

HideHUDenabled=false

original = {
draw = draw,
keyEvent = keyEvent
}

--draw function that does exactly nothing
function HideHUDdraw()
end

--since gameMenuSystem from main.lua has a higher priority than modClassEventListener's keyEvent then we need a workaround
function HideHUDkeyEvent(unicode, sym, modifier, isDown)

original.keyEvent(unicode, sym, modifier, isDown)

if gameMenuSystem.currentMenu ~= nil and HideHUDenabled then
_G.draw = original.draw
print("[HideHUD Mod] disabling HideHUD - in game menu open")
HideHUDenabled = false
end

end

print("[HideHUD Mod] overriding the keyEvent function")
_G.keyEvent = HideHUDkeyEvent

modClassEventListener = {};


function modClassEventListener:loadMap(name)

end;

function modClassEventListener:deleteMap()

end;

function modClassEventListener:mouseEvent(posX, posY, isDown, isUp, button)

end;

function modClassEventListener:keyEvent(unicode, sym, modifier, isDown)
if isDown and sym == 291 then
HideHUDenabled = not HideHUDenabled

if HideHUDenabled then
_G.draw = HideHUDdraw
print("[HideHUD Mod] enabling HideHUD - F10 key")
else
_G.draw = original.draw
print("[HideHUD Mod] disabling HideHUD - F10 key")
end
end
end;

function modClassEventListener:update(dt)
end;

function modClassEventListener:draw()

end;

addModEventListener(modClassEventListener);
9 changes: 9 additions & 0 deletions HideHUD/modDesc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
<modDesc descVersion="1">
<author>Morc</author>
<version>0.01</version>

<extraSourceFiles>
<sourceFile filename="hidehud.lua" />
</extraSourceFiles>
</modDesc>

0 comments on commit 70243b3

Please sign in to comment.