public Screen_StressTest() { aui_instances = new List <AUI_Base>(); button_back = new AUI_Button( 16 * 3, 16 * 2 + 8, 16 * 3, "< to title"); button_back.CenterText(); aui_instances.Add(button_back); timer_text = new AUI_Text("time", 16 * 6 + 8, 16 * 2 + 5, Microsoft.Xna.Framework.Color.White); aui_instances.Add(timer_text); int g = 0; //counter/id for (int x = 0; x < 28; x++) { for (int y = 0; y < 16; y++) { AUI_Button button = new AUI_Button( 48 + (x * 25), //x 64 + (25 * y), //y 24, //width "" + g); //title button.CenterText(); button.draggable = true; aui_instances.Add(button); g++; } } }
public Screen_Example() { aui_instances = new List <AUI_Base>(); button_back = new AUI_Button( 16 * 3, 16 * 2 + 8, 16 * 3, "< to title"); button_back.CenterText(); aui_instances.Add(button_back); }
public Screen_Radial() { aui_instances = new List <AUI_Base>(); button_back = new AUI_Button( 16 * 3, 16 * 2 + 8, 16 * 3, "< to title"); button_back.CenterText(); aui_instances.Add(button_back); int btnWidth = 16 * 5; //left set radial_TopLeft = new AUI_ButtonWithLine(-256, -256, btnWidth, "btn a"); radial_TopLeft.offsetX = btnWidth; radial_TopLeft.offsetY = 8; aui_instances.Add(radial_TopLeft); radial_MidLeft = new AUI_ButtonWithLine(-256, -256, btnWidth, "btn b"); radial_MidLeft.offsetX = btnWidth; radial_MidLeft.offsetY = 8; aui_instances.Add(radial_MidLeft); radial_BotLeft = new AUI_ButtonWithLine(-256, -256, btnWidth, "btn c"); radial_BotLeft.offsetX = btnWidth; radial_BotLeft.offsetY = 8; aui_instances.Add(radial_BotLeft); //right set radial_TopRight = new AUI_ButtonWithLine(-256, -256, btnWidth, "btn d"); radial_TopRight.offsetX = 0; radial_TopRight.offsetY = 8; aui_instances.Add(radial_TopRight); radial_MidRight = new AUI_ButtonWithLine(-256, -256, btnWidth, "btn e"); radial_MidRight.offsetX = 0; radial_MidRight.offsetY = 8; aui_instances.Add(radial_MidRight); radial_BotRight = new AUI_ButtonWithLine(-256, -256, btnWidth, "btn f"); radial_BotRight.offsetX = 0; radial_BotRight.offsetY = 8; aui_instances.Add(radial_BotRight); introText = new AUI_Text( "press and hold spacebar to open the radial menu", 16 * 7, 16 * 2 + 8, Assets.TextColor); aui_instances.Add(introText); }
public Screen_Spider() { aui_instances = new List <AUI_Base>(); button_back = new AUI_Button( 16 * 3, 16 * 2 + 8, 16 * 3, "< to title"); button_back.CenterText(); aui_instances.Add(button_back); /* * for(int x = 0; x < 9; x++) * { * for (int y = 0; y < 1; y++) * { * //create test spider button * AUI_SpiderQueenButton spiderQueen = * new AUI_SpiderQueenButton( * 16 * 5 + ((16 * 4 + 6) * x), * 16 * 17 + (16 * 4 * y), * "test", aui_instances); * aui_instances.Add(spiderQueen); * } * } */ //single AUI_SpiderQueenButton test = new AUI_SpiderQueenButton( 16 * 22, 16 * 18, "hmm...", aui_instances); aui_instances.Add(test); /* * AUI_LineWithRecs line0 = new AUI_LineWithRecs(); * line0.MoveTo(16 * 5, 16 * 15); * line0.SetTarget(16 * 45, 16 * 15); * aui_instances.Add(line0); * * AUI_LineWithRecs line1 = new AUI_LineWithRecs(); * line1.MoveTo(16 * 5, 16 * 20); * line1.SetTarget(16 * 45, 16 * 20); * aui_instances.Add(line1); */ }
public AUI_SpiderQueenButton(int X, int Y, String Text, List <AUI_Base> LR) { button = new AUI_Button(X, Y, 16 * 4, Text); button.CenterText(); lines = new List <AUI_Line>(); //create 8 legs, update will match their positions for (i = 0; i < 8; i++) { AUI_Line line = new AUI_Line(); line.displayState = DisplayState.Closed; lines.Add(line); } displayState = DisplayState.Closed; ListRef = LR; }
public Screen_Example1() { aui_instances = new List <AUI_Base>(); button_back = new AUI_Button( 16 * 3, 16 * 2 + 8, 16 * 3, "< to title"); button_back.CenterText(); aui_instances.Add(button_back); //add some crown buttons for testing for (int g = 0; g < 5; g++) { AUI_CrownButton crown = new AUI_CrownButton( 16 * 6 + (g * 120), //x (16 * 22), //y 16 * 2 + 16 * g, //width "test " + g); //title //animate kids, except last one crown.wiggleChildren = true; if (g == 5) { crown.wiggleChildren = false; } aui_instances.Add(crown); } //add some sliders for testing for (int g = 0; g < 5; g++) { AUI_Slider_Horizontal slider = new AUI_Slider_Horizontal( 16 * 6 + (g * 120), (16 * 7)); slider.Open(g * 0.2f); //make the last few sliders display as float (not percentage) if (g > 2) { slider.valueType = SliderValueType.Float; } aui_instances.Add(slider); } }
public AUI_CrownButton(int X, int Y, int W, string Title) { button = new AUI_Button( X, Y, W, Title); button.CenterText(); //setup crown children aui_crown_children = new List <AUI_ButtonWithLine>(); button_crown_child1 = new AUI_ButtonWithLine(0, 0, 16 * 4, "test a"); button_crown_child1.line.line.animType = LineAnimType.Reverse; button_crown_child1.button.draggable = true; aui_crown_children.Add(button_crown_child1); button_crown_child2 = new AUI_ButtonWithLine(0, 0, 16 * 4, "test b"); button_crown_child2.line.line.animType = LineAnimType.Reverse; button_crown_child2.button.draggable = true; aui_crown_children.Add(button_crown_child2); button_crown_child3 = new AUI_ButtonWithLine(0, 0, 16 * 4, "test c"); button_crown_child3.line.line.animType = LineAnimType.Reverse; button_crown_child3.button.draggable = true; aui_crown_children.Add(button_crown_child3); button_crown_child4 = new AUI_ButtonWithLine(0, 0, 16 * 4, "test d"); button_crown_child4.line.line.animType = LineAnimType.Reverse; button_crown_child4.button.draggable = true; aui_crown_children.Add(button_crown_child4); button_crown_child5 = new AUI_ButtonWithLine(0, 0, 16 * 4, "test e"); button_crown_child5.line.line.animType = LineAnimType.Reverse; button_crown_child5.button.draggable = true; aui_crown_children.Add(button_crown_child5); button_crown_child6 = new AUI_ButtonWithLine(0, 0, 16 * 4, "test f"); button_crown_child6.line.line.animType = LineAnimType.Reverse; button_crown_child6.button.draggable = true; aui_crown_children.Add(button_crown_child6); //place crown children PlaceChildren(); CloseChildren(); }
public override void Update() { button.Update(); for (i = 0; i < 8; i++) { lines[i].Update(); } //miniphysics: apply friction to magnitude per axis magnitude.X = magnitude.X * friction; magnitude.Y = magnitude.Y * friction; //display states if (displayState == DisplayState.Opening) { if (button.displayState == DisplayState.Opened) { displayState = DisplayState.Opened; } } else if (displayState == DisplayState.Opened) { #region Button Click Input //on click, spider wanders around if (Input.IsLeftMouseBtnPress()) { if (Functions.Contains( button.window.rec_bkg.openedRec, Input.cursorPos.X, Input.cursorPos.Y)) { if (wandering == false) { //open all legs start wandering around for (i = 0; i < 8; i++) { lines[i].Open(); } wandering = true; ChooseDirection(); } //spawn a child as feedback SpawnChildren(); //change text as well button.text.ChangeText("XXXXXXXXXXXXX"); button.CenterText(); } } #endregion #region Wandering Routine //if spider is wandering around, the legs should be //open and wiggling about if (wandering) { //randomly choose a target to move button to button.MoveTo( (int)(button.window.rec_bkg.openedRec.X + magnitude.X), (int)(button.window.rec_bkg.openedRec.Y + magnitude.Y)); //count wandering frames wanderCounter++; if (wanderCounter > wanderTotal) { //goto resting state wanderCounter = 0; wandering = false; //close all legs for (i = 0; i < 8; i++) { lines[i].Close(); } //change text //change text as well button.text.ChangeText("hmm..."); button.CenterText(); } //randomly modify moving direction if (Functions.Random.Next(0, 101) > 98) { ChooseDirection(); } } #endregion } else if (displayState == DisplayState.Closing) { if (button.displayState == DisplayState.Closed) { displayState = DisplayState.Closed; } } else if (displayState == DisplayState.Closed) { } //work that happens when button isn't closed if (displayState != DisplayState.Closed) { #region Anchor legs to button //top of button lines[0].SetAnchor( button.window.rec_bkg.openedRec.X + 8, button.window.rec_bkg.openedRec.Y); lines[1].SetAnchor( button.window.rec_bkg.openedRec.X + 24, button.window.rec_bkg.openedRec.Y); lines[2].SetAnchor( button.window.rec_bkg.openedRec.X + 40, button.window.rec_bkg.openedRec.Y); lines[3].SetAnchor( button.window.rec_bkg.openedRec.X + 56, button.window.rec_bkg.openedRec.Y); //bottom of button lines[4].SetAnchor( button.window.rec_bkg.openedRec.X + 8, button.window.rec_bkg.openedRec.Y + 16); lines[5].SetAnchor( button.window.rec_bkg.openedRec.X + 24, button.window.rec_bkg.openedRec.Y + 16); lines[6].SetAnchor( button.window.rec_bkg.openedRec.X + 40, button.window.rec_bkg.openedRec.Y + 16); lines[7].SetAnchor( button.window.rec_bkg.openedRec.X + 56, button.window.rec_bkg.openedRec.Y + 16); #endregion #region Place legs away from body like spider //top of button lines[0].SetTarget( button.window.rec_bkg.openedRec.X + 5, button.window.rec_bkg.openedRec.Y - 8); lines[1].SetTarget( button.window.rec_bkg.openedRec.X + 21, button.window.rec_bkg.openedRec.Y - 8); lines[2].SetTarget( button.window.rec_bkg.openedRec.X + 43, button.window.rec_bkg.openedRec.Y - 8); lines[3].SetTarget( button.window.rec_bkg.openedRec.X + 60, button.window.rec_bkg.openedRec.Y - 8); //bottom of button lines[4].SetTarget( button.window.rec_bkg.openedRec.X + 5, button.window.rec_bkg.openedRec.Y + 16 + 8); lines[5].SetTarget( button.window.rec_bkg.openedRec.X + 21, button.window.rec_bkg.openedRec.Y + 16 + 8); lines[6].SetTarget( button.window.rec_bkg.openedRec.X + 43, button.window.rec_bkg.openedRec.Y + 16 + 8); lines[7].SetTarget( button.window.rec_bkg.openedRec.X + 60, button.window.rec_bkg.openedRec.Y + 16 + 8); #endregion #region leg animation routine if (wandering) { //sort button over other buttons button.window.rec_bkg.zDepth = Assets.Layer_WindowFront; button.window.rec_fore.zDepth = Assets.Layer_WindowFront; //modify leg positions each frame as if moving for (i = 0; i < 8; i++) { lines[i].SetTarget( lines[i].Xa + Functions.Random.Next(-4, 5), lines[i].Ya + Functions.Random.Next(-4, 5)); lines[i].zDepth = Assets.Layer_WindowFront; } } #endregion else { //set button and lines on lower layers (behind) button.window.rec_bkg.zDepth = Assets.Layer_WindowBack; button.window.rec_fore.zDepth = Assets.Layer_WindowBack; for (i = 0; i < 8; i++) { lines[i].zDepth = Assets.Layer_Lines; } } #region Keep button onscreen (push back to center) if (button.window.rec_bkg.openedRec.X > Assets.GDM.PreferredBackBufferWidth) { magnitude.X = -3; } if (button.window.rec_bkg.openedRec.X < 0) { magnitude.X = 3; } if (button.window.rec_bkg.openedRec.Y > Assets.GDM.PreferredBackBufferHeight) { magnitude.Y = -3; } if (button.window.rec_bkg.openedRec.Y < 0) { magnitude.Y = 3; } #endregion } }
public Screen_Title() { aui_instances = new List <AUI_Base>(); button_screen1 = new AUI_Button( 16 * 8, 16 * 20, 16 * 5, "crown example"); button_screen1.CenterText(); aui_instances.Add(button_screen1); button_screen2 = new AUI_Button( 16 * 15, 16 * 20, 16 * 5, "stress test"); button_screen2.CenterText(); aui_instances.Add(button_screen2); button_screen3 = new AUI_Button( 16 * 22, 16 * 20, 16 * 5, "spider game"); button_screen3.CenterText(); aui_instances.Add(button_screen3); button_screen4 = new AUI_Button( 16 * 29, 16 * 20, 16 * 5, "example 4"); button_screen4.CenterText(); aui_instances.Add(button_screen4); button_screen5 = new AUI_Button( 16 * 36, 16 * 20, 16 * 5, "example 5"); button_screen5.CenterText(); aui_instances.Add(button_screen5); titleText = new AUI_Text("grak's aui lab", 16 * 8, 16 * 5, Assets.ForegroundColor); titleText.scale = 10.0f; aui_instances.Add(titleText); descText = new AUI_Text( "this monogame laboratory showcases a variety of animated ui." + "\nclick a button below to see an example.", 16 * 8, 16 * 14, Assets.ForegroundColor); descText.scale = 2.0f; aui_instances.Add(descText); AUI_LineWithRecs line0 = new AUI_LineWithRecs(); line0.MoveTo(16 * 8, 16 * 6); line0.SetTarget(16 * 41, 16 * 6); line0.line.speedOpen = 25; line0.line.speedClosed = 25; aui_instances.Add(line0); AUI_LineWithRecs line1 = new AUI_LineWithRecs(); line1.MoveTo(16 * 8, 16 * 13); line1.SetTarget(16 * 41, 16 * 13); line1.line.speedOpen = 20; line1.line.speedClosed = 25; aui_instances.Add(line1); AUI_LineWithRecs line2 = new AUI_LineWithRecs(); line2.MoveTo(16 * 8, 16 * 18); line2.SetTarget(16 * 41, 16 * 18); line2.line.speedOpen = 15; line2.line.speedClosed = 20; aui_instances.Add(line2); AUI_LineWithRecs line3 = new AUI_LineWithRecs(); line3.MoveTo(16 * 8, 16 * 23); line3.SetTarget(16 * 41, 16 * 23); line3.line.speedOpen = 10; line3.line.speedClosed = 20; aui_instances.Add(line3); }