public GuiElement(GuiLayer owningLayer, string elementText) { GuiElement.lastid++; this.id = "GuiElement_" + GuiElement.lastid; this.parentLayer = owningLayer; owningLayer.AddGUIElement(this); this.text = elementText; }
public static void Init() { Game.Clock = new DOM_Clock(); //Game.Clock.Start(); //I must be script#'ing wrong. This won't fire here. InputManager.Input.Init(); // Set up the local player Player LocalPlayer = new Player(); //Surface.Initialize(new DOM_Renderer()); //Surface.Initialize(new Canvas_Renderer()); Game.Renderer = new Canvas_Renderer(); SoundSystem = new HTML5_Audio(); //set up the primary view // Remember to initialize the renderer first! View playerOneView = new View(LightingStyle.Tiles); playerOneView.SetArea(new Rectangle(0, 0, Renderer.GetSize().width, Renderer.GetSize().height)); //notificationLayer = new GuiLayer(playerOneView, new Rectangle(0, 0, 0, 0)); notificationLayer = playerOneView.AddLayer("NotificationLayer", new Rectangle(0, 0, 0, 0)); notificationLayer.SetSize(522, 60); //notificationLayer.Hide(); //create two gui elements on the layer: //an image on the left GuiElement notifIcon = notificationLayer.AddGUIElement(""); notifIcon.AddStyle("notifIcon"); notifIcon.SetPosition(12, 0); //and sender on the right GuiElement notifSender = notificationLayer.AddGUIElement(""); notifSender.SetPosition(58, 0); notifSender.SetSize(474, 12); //and the sender's handle, if applicable GuiElement notifSenderHandle = notificationLayer.AddGUIElement(""); notifSenderHandle.SetPosition(80, 0); notifSenderHandle.SetSize(474, 12); notifSenderHandle.AddStyle("tweetName"); //and the text on the right GuiElement notifText = notificationLayer.AddGUIElement(""); notifText.SetPosition(58, 18); notifText.SetSize(474, 40); notificationLayer.Hide(); //clockRenderguy = Game.Clock.AddRender(Game.Renderer.RenderUpdate); //clockRenderguy = Game.Clock.AddRender(Game.Renderer.Render); //reposition the notification layer after a few seconds string notif_repos = Clock.AddRender(reposition_notification_layeer); Clock.delayRender(notif_repos, 2); Clock.AddCalculation(StandardCalculations); Clock.IntervalExecute(Game.StandardIntervalCalculations, .2); Game.Paused = false; }