Skip to content

Instantly share code, notes, and snippets.

@freem
Last active December 28, 2015 01:39
Show Gist options
  • Save freem/7421674 to your computer and use it in GitHub Desktop.
Save freem/7421674 to your computer and use it in GitHub Desktop.
adding PlayerOptions onto ScreenSelectMusic
# new metrics for player options placement
[ScreenSelectMusic]
PlayerOptionsP1X=
PlayerOptionsP1Y=
PlayerOptionsP1OnCommand=
PlayerOptionsP1OffCommand=
PlayerOptionsP2X=
PlayerOptionsP2Y=
PlayerOptionsP2OnCommand=
PlayerOptionsP2OffCommand=
-- BGAnimations/ScreenSelectMusic decorations.lua
local t = Def.ActorFrame {}
for pn in ivalues(PlayerNumber) do
-- and add this just before the end:
local PlayerOptions = LoadActor( THEME:GetPathG( Var "LoadingScreen", "PlayerOptions" ), pn );
t[#t+1] = StandardDecorationFromTable( "PlayerOptions" .. ToEnumShortString(pn), PlayerOptions );
end
return t
-- Graphics/ScreenSelectMusic PlayerOptions.lua
-- player options text for selectmusic
local Player = ...
if not Player then error("ScreenSelectMusic PlayerOptions requires a Player") end
return Def.ActorFrame{
LoadFont("Common normal")..{
InitCommand=cmd(zoom,1);
BeginCommand=cmd(playcommand,"Update");
PlayerOptionsChangedMessageCommand=function(self,param)
if param.PlayerNumber == Player then self:playcommand("Update") end
end;
UpdateCommand=function(self)
local pstate = GAMESTATE:GetPlayerState(Player)
self:settext(pstate:GetPlayerOptionsString('ModsLevel_Preferred'))
end;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment