hud.scoreboard.update(); hud.fpswindow.update(); def onShow(): hud.chatBox.deactivate(); hud.minimap.setMap(cvar_get("world_overhead")); hud.scoreboard.arrange(); hud.scoreboard.update(); #remove the placeholders in scoreboard hud.crosshair.reset(); hud.voteWindow.reset(); hud.timer.setCaption(""); hud.frame(); #remove any other placeholders glass.GUI_CreateScreen('hud'); ## ORDER/WAYPOINT ## waypoint = glass.GlassLabel(); waypoint.setImage("null.s2g"); waypoint.setVisible(False); waypoint.setSize(48,48); glass.GUI_ScreenAddWidget("hud", waypoint); waypointObject = None; class WaypointHandler: def onEvent(self, e): if isinstance(e, WaypointEvent): if e.eventType == 'waypoint_complete' or e.eventType == 'waypoint_cancel' or e.eventType == 'waypoint_destroy': hud.waypoint.setVisible(False); else:
loading.minimap.setSize(145, 145) loading.mininame.setCaption(world_name) loading.mininame.setX(loading.info.getWidth() // 2 - loading.mininame.getWidth() // 2) def updatePlayers(): if hasattr(savage, 'getPlayers'): players = savage.getPlayers() else: players = [] loading.players.setCaption("PLAYERS: ^w" + str(len(players)) + "/" + Client_GetStateString("svr_maxclients")) glass.GUI_CreateScreen('loading') black = DefaultContainer() black.setBackgroundColor(glass.Color(208, 208, 208)) black.setSizePct(1, 1) add(black) # concept art bg background = DefaultImage() background.setImage("/gui/loadingImages/nexus.jpg", False) ratio = background.getWidth() / float(background.getHeight()) background.setHeight(screenHeight) background.setWidth(int(screenHeight * ratio)) add(background, screenWidth // 2 - background.getWidth() // 2, screenHeight // 2 - background.getHeight() // 2)
# (c) 2010 savagerebirth.com from silverback import *; import glass; def frame(): pass; def onShow(): pass; glass.GUI_CreateScreen('guitest'); bg = glass.GlassLabel(); bg.setBackgroundColor(glass.Color(128,128,128)); bg.setOpaque(1); bg.setSizePct(1,1); glass.GUI_ScreenAddWidget("guitest", bg); tomain = glass.GlassButton("Main Menu"); tomain.setPosition(0,screenHeight-tomain.getHeight()); tomain.setClickAction("GUI_ShowScreen('mainmenu')"); glass.GUI_ScreenAddWidget("guitest", tomain); execwindow.newExecWindow("guitest"); # ############################## # Start testing stuff from here! testAlpha = glass.GlassContainer(); testAlpha.setAlpha(20);
self.losses.setX(self.kills.getX()+self.kills.getWidth()); def update(self): player = savage.getLocalPlayer(); team = savage.getTeamObject(player.getTeam()); self.kills.setCaption("^g"+("% 3d"%player.getKills())); self.losses.setCaption("^900"+str(player.getDeaths())); self.levelLabel.setCaption("LEVEL: "+("% 3d"%player.getLevel())); self.level.setProgress(player.getXp()/float(savage.getXPForLevel(team.getRace(), player.getLevel()+1))); gblEventHandler.addGameListener(SpawnSelectHandler()); ## CREATE SCREEN ## glass.GUI_CreateScreen("loadout"); overlay = DefaultImage(); overlay.setImage("/gui/main/images/loading_overlay.png", False); overlay.setSizePct(1.0,1.0); glass.GUI_ScreenAddWidget("loadout", overlay); activeWindow = None; humanLoadout = LoadoutWindow("human"); glass.GUI_ScreenAddWidget("loadout", humanLoadout); beastLoadout = LoadoutWindow("beast"); glass.GUI_ScreenAddWidget("loadout", beastLoadout); #well, here's a fine hack. #glass.GUI_ScreenAddWidget("loadout", gblPresetManager);
# (c) 2010 savagerebirth.com from silverback import * import glass def frame(): pass def onShow(): pass glass.GUI_CreateScreen('modeltest') class ModelChangeHandler: def onValueChanged(self, e): modeltest.modelviewer.setModel( modeltest.modeldropmenu.getSelectedValue()) class AnimChangeHandler: def onValueChanged(self, e): modeltest.modelviewer.setAnimation( modeltest.animdropmenu.getSelectedValue()) bg = glass.GlassLabel() bg.setBackgroundColor(glass.Color(0, 0, 0, 255)) bg.setSizePct(1, 1)
spechud.chatBox.deactivate() spechud.minimap.setMap(cvar_get("world_overhead")) spechud.scoreboard.arrange() spechud.scoreboard.update() #remove the placeholders in scoreboard spechud.crosshair.reset() spechud.researchinfowindow1.rebuildResearchable(spechud.team1) spechud.researchinfowindow2.rebuildResearchable(spechud.team2) spechud.unitinfowindow1.buildUnitInfo(spechud.team1) spechud.unitinfowindow2.buildUnitInfo(spechud.team2) spechud.frame() #remove any other placeholders glass.GUI_CreateScreen('spechud') ## Defining both teams here as they should not change team1 = savage.Team(1) team2 = savage.Team(2) #starting from the gold to the right of the minimap and proceeding anti clockwise ## MAP and surrounding things ## minimap = glass.GlassMiniMap() minimap.setPositionPct(0, 0.025) minimap.setX(10) minimap.setSize(int(0.208 * screenHeight), int(0.208 * screenHeight)) #same number of pixels so it's square #well assuming the pixel aspect ratio is 1:1
CL_RequestScores(); endgame.updatePersonal(); endgame.accuracy_window.setVisible(False); endgame.accuracy_window.update(); endgame.accuracy_window.centerWindow(); endgame.updateGameInfo(); endgame.updateOutcome(); endgame.rebuildAwards(savage.getGameStats()); #gblEventHandler.addHttpListener(endgame.statsHandler); #endgame.statsHandler.httpHandle = HTTP_Get("http://savagerebirth.com/api/index.php/map/"+cvar_get("svr_world")); glass.GUI_CreateScreen('endgame'); bg = glass.GlassLabel(); bg.setBackgroundColor(glass.Color(0,0,0,64)); bg.setSizePct(1,1); glass.GUI_ScreenAddWidget("endgame",bg); PADDING = int(screenHeight*0.01); vbreak = 0.2; vbreakpx = int(vbreak * screenHeight); hbreak1 = 0.25; hbreak1px = int(hbreak1 * screenWidth); hbreak2 = 0.75; hbreak2px = int(hbreak2 * screenWidth); #1. Personal Information fave_unit = glass.GlassViewer(); fave_unit.setBackgroundColor(transparency);
# Copyright (c) 2011 savagerebirth.com # this file creates the lobby from silverback import *; import glass; import savage; def frame(): lobby.update(); def onShow(): lobby.arrange(); glass.GUI_CreateScreen('lobby'); bg = glass.GlassLabel(" "); bg.setBackgroundColor(black); bg.setOpaque(1); bg.setSizePct(1,1); bg.setPositionPct(0,0); glass.GUI_ScreenAddWidget("lobby", bg); boxWidth = 0.2; boxHeight = 0.5; buttonHeight = boxHeight / 10; totalPadding = 0.05; paddingPerBox = totalPadding / 8; centralPadding = 0.15; interface = glass.GlassContainer(); interface.setBackgroundColor( tangoGrey2 );
def onShow(): commcontexts.buildContextsIfNeeded(); commhud.contextmenu.setVisible(False); commhud.contextmenu.close(); commhud.resourcesPanel.resetDiffCounters(); commhud.resourcesPanel.update(); commhud.chatBox.deactivate(); commhud.minimap.setMap(cvar_get("world_overhead")); commhud.unitinfowindow.buildUnitInfo(savage.Team( savage.getLocalPlayer().getTeam() )); commhud.researchWindow.onTeamChange(); commhud.scoreboard.arrange(); commhud.scoreboard.update(); #remove the placeholders in scoreboard glass.GUI_CreateScreen('commhud'); selectionList = []; def clearSelection(send=True): for obj in commhud.selectionList: obj.unselect(); commhud.selectionList = []; if send: CL_SendSelection([]); #tell the server we want our selection cleared def selectObject(obj, ignorekey): if not Input_IsKeyDown(KEY_SHIFT) and not ignorekey: commhud.clearSelection(); if obj == None:
for server in list: official = "" if server.getAttribute("official") == "1": official = "^icon shield^" serverlist.list.addRow( server.getAttribute("name"), server.getAttribute("address"), server.getAttribute("num_players") + "/" + server.getAttribute("max_players"), server.getAttribute("map_name"), official) serverlist.list.adjustWidthTo(serverlist.scr.getWidth()) #in case you need it later -serverlist.scr.getScrollbarWidth()); glass.GUI_CreateScreen("serverlist") httpHandle = -1 gblEventHandler.addHttpListener(ServerListHandler()) #build the viewer background v = glass.GlassViewer() v.showWorld(1) v.setOpaque(0) v.setEnabled(0) v.setSizePct(1, .80) v.setPositionPct(0, 0) v.setCameraPosition(4720, 1830, 297) v.setCameraTarget(100, 500, 550) glass.GUI_ScreenAddWidget("serverlist", v)
#copyright savagerebirth.com (c) 2011 #demo screen from silverback import * import glass import gdata.youtube import gdata.youtube.service screen = glass.GUI_CreateScreen("demos") loadingAction = None xoffset = 0.55 #size of scroll area as a proportion of screenWidth padding = 0.01 pxpadding = 4 def frame(): pass def onShow(): if demos.loadingAction is not None: demos.loadingAction.stop() demos.list.erase() demos.loadingAction = ActionSequence(demos.DemosLoadAction()) class DemosLoadAction(Action): def __init__(self): Action.__init__(self)