Entry = {} Entry.__index = Entry function Entry.new() local self = setmetatable({}, Entry) tex.load_animations("entry") tex.load_folder("entry", "background") tex.load_folder("entry", "side_select") tex.load_folder("entry", "global") self.bg_flicker = tex.get_animation(1) self.side_select_fade = tex.get_animation(0) self.bg_flicker:start() return self end function Entry:update(current_ms) self.bg_flicker:update(current_ms) self.side_select_fade:update(current_ms) end function Entry:start_side_select() self.side_select_fade:start() end function Entry:restart_side_select() self.side_select_fade:restart() end function Entry:get_side_select_fade() return self.side_select_fade.attribute end function Entry:draw_background() tex.draw_texture("background", "bg") tex.draw_texture("background", "tower") tex.draw_texture("background", "shops_center") tex.draw_texture("background", "people") tex.draw_texture("background", "shops_left") tex.draw_texture("background", "shops_right") tex.draw_texture("background", "lights", { scale = 2.0, fade = self.bg_flicker.attribute }) end function Entry:draw_side_select(side) local fade = self.side_select_fade.attribute tex.draw_texture("side_select", "box_top_left", { fade = fade }) tex.draw_texture("side_select", "box_top_right", { fade = fade }) tex.draw_texture("side_select", "box_bottom_left", { fade = fade }) tex.draw_texture("side_select", "box_bottom_right", { fade = fade }) tex.draw_texture("side_select", "box_top", { fade = fade }) tex.draw_texture("side_select", "box_bottom", { fade = fade }) tex.draw_texture("side_select", "box_left", { fade = fade }) tex.draw_texture("side_select", "box_right", { fade = fade }) tex.draw_texture("side_select", "box_center", { fade = fade }) tex.draw_texture("side_select", "1P", { fade = fade }) tex.draw_texture("side_select", "cancel", { fade = fade }) tex.draw_texture("side_select", "2P", { fade = fade }) if side == 0 then tex.draw_texture("side_select", "1P_highlight", { fade = fade }) tex.draw_texture("side_select", "1P2P_outline", { mirror = "horizontal", fade = fade, index = 0 }) elseif side == 1 then tex.draw_texture("side_select", "cancel_highlight", { fade = fade }) tex.draw_texture("side_select", "cancel_outline", { fade = fade }) else tex.draw_texture("side_select", "2P_highlight", { fade = fade }) tex.draw_texture("side_select", "1P2P_outline", { fade = fade, index = 1 }) end end function Entry:draw_footer(p1_joined, p2_joined) tex.draw_texture("side_select", "footer") if p1_joined and p2_joined then -- both players joined, no footer sides elseif not p1_joined and not p2_joined then tex.draw_texture("side_select", "footer_left") tex.draw_texture("side_select", "footer_right") elseif p1_joined then tex.draw_texture("side_select", "footer_right") else tex.draw_texture("side_select", "footer_left") end end function Entry:draw_player_entry() tex.draw_texture("global", "player_entry") end