Example #1
0
        static void Main(string[] args)
        {
            ExampleApplication.Initialise();

            Gui.Initialise();

            Test_Button.Test();
            Test_Canvas.Test();
            Test_ComboBox.Test();
            Test_DDContainer.Test();
            Test_EditBox.Test();
            Test_HScrollBox.Test();
            Test_ItemBox.Test();
            Test_ListBox.Test();
            Test_MenuBar.Test();
            Test_MenuCtrl.Test();
            Test_MessageBox.Test();
            Test_MultiListBox.Test();
            Test_PopupMenu.Test();
            Test_ProgressBar.Test();
            Test_RenderBox.Test();
            Test_ScrollView.Test();
            Test_StaticImage.Test();
            Test_StaticText.Test();
            Test_TabBar.Test();
            Test_VScrollBar.Test();
            Test_Widget.Test();
            Test_Window.Test();

            Test_Gui.Test();

            ExampleApplication.AddFrameDelegate(new ExampleApplication.HandleFrameStart(FrameStart));
            ExampleApplication.Run();
        }
Example #2
0
        private static void Main()
        {
            var app    = new ExampleApplication();
            var logic  = new GameLogic();            //todo student: load the game state
            var visual = new Visual();

            app.GameWindow.Closing += (s, e) => { /*todo student: save the game state */ };
            app.Resize             += (w, h) => visual.Resize(logic.GameState, w, h);
            app.Render             += () =>
            {
                var score = "white:" + logic.CountWhite.ToString() + " black:" + logic.CountBlack.ToString();;
                app.GameWindow.Title = score;
                visual.Render(logic.GameState);
                if (GameLogic.Result.PLAYING != logic.CurrentGameResult)
                {
                    var winner = logic.CurrentGameResult.ToString();
                    visual.PrintMessage(winner);
                }
            };
            app.GameWindow.MouseDown += (s, e) =>
            {
                if (e.Button != MouseButton.Left)
                {
                    return;                                                                           //only accept left mouse button
                }
                var coord   = app.CalcNormalized(e.X, e.Y);                                           //convert mouse coordinates from pixel to [0,1]²
                var gridPos = visual.CalcGridPosFromNormalized(new OpenTK.Vector2(coord.X, coord.Y)); //convert normalized mouse coordinates into grid coordinates
                logic.Move(gridPos);                                                                  //do move
            };
            app.Run();
        }
Example #3
0
        private static void Main()
        {
            var app        = new ExampleApplication();
            var controller = new Controller();

            app.Render += controller.Render;
            app.Update += controller.Update;
            app.Run();
        }
Example #4
0
        private static void Main()
        {
            var app  = new ExampleApplication();
            var game = new Game();

            app.Update += game.Update;
            app.Render += game.Render;
            app.Run();
        }
Example #5
0
        private static void Main()
        {
            var app      = new ExampleApplication();
            var renderer = new Renderer();

            LoadResources(renderer);
            GameLogic gameLogic = new GameLogic(renderer);

            Stopwatch timeSource = new Stopwatch();

            app.Update += (t) => HandleInput(gameLogic, (float)timeSource.Elapsed.TotalSeconds);
            app.Resize += renderer.ResizeWindow;
            app.Render += () => renderer.DrawScreen(GameLogic.visibleFrame, gameLogic.Points);

            timeSource.Start();
            app.Run();
        }
Example #6
0
 private static void GettingStarted()
 {
     ExampleApplication.Run();
 }