Example #1
0
        protected override void OnLoad(System.EventArgs e)
        {
            Noesis.GUI.Init();
            //EmbeddedXaml[] xamls = new EmbeddedXaml[]
            //{
            //        new EmbeddedXaml { filename = "Reflections.xaml", resource = "Reflections" }
            //};
            //Noesis.GUI.SetXamlProvider(new LocalXamlProvider("."));



            // Data loading
            Noesis.GUI.SetXamlProvider(new NoesisApp.LocalXamlProvider("."));
            //Noesis.Grid xaml = (Noesis.Grid)Noesis.GUI.LoadXaml("UI\\UItest0.xaml");
            xaml = new Noesis.Grid();
            Noesis.GUI.LoadComponent(xaml, "UI\\UItest03.xaml");
            //MyGrid xaml = new MyGrid();

            Noesis.StackPanel sp = (Noesis.StackPanel)xaml.FindName("BottomMenu");
            sp.DataContext = new ViewModel();



            Noesis.Button button = (Noesis.Button)xaml.FindName("button");

            button.Click += (object sender, Noesis.RoutedEventArgs args) =>
            {
                System.Console.WriteLine("Button was clicked");
            };


            // create view
            nView = Noesis.GUI.CreateView(xaml);

            nView.SetSize(this.Width, this.Height);
            // get OpenGL rendering device
            Noesis.RenderDevice device = new Noesis.RenderDeviceGL();

            // init renderer as OpenGL
            renderer = nView.Renderer;
            renderer.Init(device);


            nView.Update(0.001); // Ensures view is updated before first render call (avoids crash)


            CursorVisible = true;



            mousePos            = new Vector2(this.PointToClient(new Point(Mouse.GetCursorState().X, Mouse.GetCursorState().Y)).X, this.PointToClient(new Point(Mouse.GetCursorState().X, Mouse.GetCursorState().Y)).Y);
            Input.mousePosition = mousePos;
            //GL.Disable()
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);


            GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);


            spritedrawer  = new SpriteDrawer(view);
            cursorTexture = SpriteDrawer.LoadTexture("PNG\\crosshair010.png", true, false);



            texture = SpriteDrawer.LoadTexture("PNG\\playerShip1_red.png", true, false);

            player  = new PlayerShip(0, 0, 0, texture, SpriteDrawer.LoadTexture("PNG\\Lasers\\laserBlue01.png", true, false), view);
            enemyAI = new AI(spaceObjects, player);
            Ship enemy1 = new Ship(200, 200, 0, SpriteDrawer.LoadTexture("PNG\\ufoBlue.png", true, false));

            player.setTarget(enemy1);


            enemyAI.takeControl(enemy1);
            spaceObjects.Add(enemy1);


            Closed += OnClosed;
        }
Example #2
0
File: AI.cs Project: vjoensen/A5k
 public AI(List <SpaceObject> world, PlayerShip player)
 {
     this.world  = world;
     this.player = player;
     minions     = new List <Ship>();
 }