public MenuManager(Main game, String[] strMenuTextures, String strMenuFont, Integer2 textureBorderPadding) : base(game) { this.game = game; //nmcg - create an array of textures this.menuTextures = new Texture2D[strMenuTextures.Length]; //nmcg - load the textures for (int i = 0; i < strMenuTextures.Length; i++) { this.menuTextures[i] = game.Content.Load<Texture2D>(@"" + strMenuTextures[i]); } //nmcg - load menu font this.menuFont = game.Content.Load<SpriteFont>(@"" + strMenuFont); //nmcg - stores all menu item (e.g. Save, Resume, Exit) objects this.menuItemList = new List<MenuItem>(); //sets menu texture to fullscreen minus and padding on XY this.textureRectangle = menuTextures[0].Bounds; }
private void InitUiArchetypes() { Texture2D texture = Textures["bStart"]; Integer2 dimensions = new Integer2(texture.Width, texture.Height); Transform2D transform2D = new Transform2D(Vector2.Zero, 0, Vector2.One, Vector2.Zero, dimensions); UITextureObject uiTextureObject = new UITextureObject("texture", ActorType.UITextureObject, StatusType.Drawn | StatusType.Update, transform2D, Color.White, 0.6f, SpriteEffects.None, texture, new Rectangle(0, 0, texture.Width, texture.Height)); string text = ""; dimensions = new Integer2(Fonts["Arial"].MeasureString(text)); transform2D = new Transform2D(Vector2.Zero, 0, Vector2.One, Vector2.Zero, dimensions); UITextObject uiTextObject = new UITextObject("text", ActorType.UIText, StatusType.Drawn | StatusType.Update, transform2D, Color.Black, 0.1f, SpriteEffects.None, text, Fonts["Arial"]); text = ""; texture = Textures["bStart"]; dimensions = new Integer2(texture.Width, texture.Height); Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / 2f); transform2D = new Transform2D(Vector2.Zero, 0, Vector2.One, origin, dimensions); UIButtonObject uiButtonObject = new UIButtonObject("button", ActorType.UIButtonObject, StatusType.Update | StatusType.Drawn, transform2D, Color.White, 0.5f, SpriteEffects.None, texture, new Rectangle(0, 0, texture.Width, texture.Height), text, Fonts["Arial"], Vector2.One, GameConstants.colorGold, Vector2.Zero); uiButtonObject.ControllerList.Add(new UiScaleLerpController("USC", ControllerType.Ui, mouseManager, new TrigonometricParameters(0.05f, 0.1f, 180))); UiArchetypes.Add("button", uiButtonObject); UiArchetypes.Add("texture", uiTextureObject); UiArchetypes.Add("text", uiTextObject); }
private void Integer2_KeyPress(object sender, KeyPressEventArgs e) { if (!Char.IsDigit(e.KeyChar) && !(e.KeyChar.ToString() == "," && Integer2.Text.IndexOf(',') == -1) && e.KeyChar != '\b') { /*сообщение о нажатии клавиши не должно передаваться элементу управления*/ e.Handled = true; } if (e.KeyChar.Equals((char)13)) { Integer2.Focus(); //Enter } }
protected override void Initialize() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //add the component to handle all system events this.eventDispatcher = new EventDispatcher(this, 20); Components.Add(this.eventDispatcher); this.resolution = ScreenUtility.XVGA; this.screenCentre = this.resolution / 2; InitializeGraphics(); InitializeEffects(); InitializeDictionaries(); LoadAssets(); //Keyboard this.keyboardManager = new KeyboardManager(this); Components.Add(this.keyboardManager); //Mouse bool bMouseVisible = true; this.mouseManager = new MouseManager(this, bMouseVisible); this.mouseManager.SetPosition(this.screenCentre); Components.Add(this.mouseManager); //bundle together for easy passing this.inputManagerParameters = new InputManagerParameters(this.mouseManager, this.keyboardManager); //this is a list that updates all cameras this.cameraManager = new CameraManager(this, 3); Components.Add(this.cameraManager); //Object3D this.object3DManager = new ObjectManager(this, this.cameraManager, this.eventDispatcher, StatusType.Drawn | StatusType.Update); Components.Add(this.object3DManager); //Sound this.soundManager = new SoundManager(this, this.eventDispatcher, StatusType.Update, "Content/Assets/Audio/", "Demo2DSound.xgs", "WaveBank1.xwb", "SoundBank1.xsb"); Components.Add(this.soundManager); //Menu this.menuManager = new MenuManager(this, this.inputManagerParameters, this.cameraManager, this.spriteBatch, this.eventDispatcher, StatusType.Off); Components.Add(this.menuManager); int scale = 1250; InitializeGround(scale); InitializeSkyBox(scale); InitializeTorusDecorator(); InitializeSemiTransparentDecorators(); InitializeDrivableObject(); InitialiseDecoratorClones(); InitializeCameras(ScreenLayoutType.Pip); InitializeMainMenu(); InitializeOptionMenu(); this.menuManager.SetActiveMenu(AppData.MenuMainID); //since debug needs sprite batch then call here InitializeDebug(true); base.Initialize(); }
public void Render(GameViewRenderer gameViewRenderer, GameTile tile, Integer2 position) { GameViewRenderer = gameViewRenderer; Tile = tile; Position = position; }
public OffsetAndRotation(Integer2 offset, BuildingOrientation orientation) { Offset = offset; Orientation = orientation; }