public static void Update()
        {
            string mouse = Gui.Instance.MouseFocus.ToString() + "(" + (Gui.Instance.MouseFocusWidget == null ? "null" : Gui.Instance.MouseFocusWidget.ToString()) + ")";
            string key   = Gui.Instance.KeyFocus.ToString() + "(" + (Gui.Instance.KeyFocusWidget == null ? "null" : Gui.Instance.KeyFocusWidget.ToString()) + ")";

            ExampleApplication.DebugOut("GUI: mouse=" + mouse + "   key=" + key);
        }
Exemple #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();
        }
Exemple #3
0
 protected void OKButton_Click(object sender, EventArgs e)
 {
     ExampleApplication.GetCurrentSession().BeginTransaction();
     InsertForm.InsertItem(true);
     ExampleApplication.GetCurrentSession().Transaction.Commit();
     Response.Redirect("~/ViewData.aspx");
 }
        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();
        }
Exemple #5
0
        private static void Main()
        {
            var app        = new ExampleApplication();
            var controller = new Controller();

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

            app.Update += game.Update;
            app.Render += game.Render;
            app.Run();
        }
Exemple #7
0
        /// <summary>
        ///     If your activity returns a value, derive from <see cref="AbstractCodeActivity{T}" />
        ///     and return the value from the Execute method.
        /// </summary>
        /// <param name="context"></param>
        protected override void ExecuteActivity(CodeActivityContext context)
        {
            // Obtain the runtime value of the CustomEditor input argument
            string customEditor = context.GetValue(CustomEditor);

            IExampleApplication exampleApplication = new ExampleApplication();

            exampleApplication.ExampleEditor = customEditor;

            context.SetValue(Output, "This text will be shown: " + customEditor);
        }
Exemple #8
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();
        }
 static void widget_EventMouseButtonPressed(Widget _sender, int _left, int _top, MouseButton _id)
 {
     ExampleApplication.DebugOut("EventMouseButtonPressed  _left=" + _left.ToString() + "   _top=" + _top.ToString() + "   _id=" + _id.ToString());
 }
 static void widget_EventMouseButtonDoubleClick(Widget _sender)
 {
     ExampleApplication.DebugOut("EventMouseButtonDoubleClick");
 }
Exemple #11
0
 static void box_EventMessageBoxResult(MessageBox _sender, MessageBoxStyle _result)
 {
     ExampleApplication.DebugOut("EventMessageBoxResult  _result=" + _result.ToString());
 }
 static void tab_EventTabChangeSelect(TabBar _sender, uint _index)
 {
     ExampleApplication.DebugOut("EventTabChangeSelect  index=" + _index.ToString());
 }
 static void widget_EventKeyButtonReleased(Widget _sender, KeyCode _key)
 {
     ExampleApplication.DebugOut("EventKeyButtonReleased  _key=" + _key.ToString());
 }
Exemple #14
0
        public void DeleteItem(Item item)
        {
            ISession session = ExampleApplication.GetCurrentSession();

            session.Delete(session.Load(typeof(Item), item.Id));
        }
Exemple #15
0
 static void box_EventComboAccept(ComboBox _sender, uint _index)
 {
     ExampleApplication.DebugOut("EventComboAccept  index=" + _index.ToString());
 }
 static void widget_EventActionInfo(Widget _sender, string _key, string _value)
 {
     ExampleApplication.DebugOut("EventActionInfo  _key=" + _key + "  _value=" + _value);
 }
 static void widget_EventKeyLostFocus(Widget _sender, Widget _new)
 {
     ExampleApplication.DebugOut("EventKeyLostFocus  _new=" + (_new == null ? "null" : _new.ToString()));
 }
 static void widget_EventToolTip(Widget _sender, ToolTipInfo _info)
 {
     ExampleApplication.DebugOut("EventToolTip  _info=" + _info.ToString());
 }
 static void widget_EventRootKeyChangeFocus(Widget _sender, bool _focus)
 {
     ExampleApplication.DebugOut("EventRootKeyChangeFocus  _focus=" + _focus.ToString());
 }
 static void widget_EventKeyButtonPressed(Widget _sender, KeyCode _key, uint _char)
 {
     ExampleApplication.DebugOut("EventMouseMove  _key=" + _key.ToString() + "   _char=" + _char.ToString());
 }
 static void box_EventUpdateViewport(RenderBox _sender)
 {
     ExampleApplication.DebugOut("EventUpdateViewport");
 }
Exemple #22
0
 public IList <Item> GetAllItems()
 {
     return(ExampleApplication.GetCurrentSession().CreateQuery("from Item").List <Item>());
 }
Exemple #23
0
 static void box_EventComboChangePosition(ComboBox _sender, uint _index)
 {
     ExampleApplication.DebugOut("EventComboChangePosition  index=" + _index.ToString());
 }
 static void widget_EventMouseWheel(Widget _sender, int _rel)
 {
     ExampleApplication.DebugOut("EventMouseWheel  _rel=" + _rel.ToString());
 }
Exemple #25
0
 public void UpdateItem(Item item)
 {
     ExampleApplication.GetCurrentSession().SaveOrUpdateCopy(item);
 }
Exemple #26
0
 private static void GettingStarted()
 {
     ExampleApplication.Run();
 }
Exemple #27
0
 public void InsertItem(Item item)
 {
     ExampleApplication.GetCurrentSession().Save(item);
 }
 static void widget_EventKeySetFocus(Widget _sender, Widget _old)
 {
     ExampleApplication.DebugOut("EventKeySetFocus  _old=" + (_old == null ? "null" : _old.ToString()));
 }
Exemple #29
0
 static void box_EventEditTextChange(EditBox _sender)
 {
     ExampleApplication.DebugOut("EventEditTextChange");
 }
Exemple #30
0
 static void box_EventEditSelectAccept(EditBox _sender)
 {
     ExampleApplication.DebugOut("EventEditSelectAccept");
 }