Exemple #1
0
 public void AddStage(Stage s)
 {
     TheatreStage ts = new TheatreStage();
     ts.value = s;
     ts.enable = true;
     stages.Add(ts);
 }
Exemple #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            uc = new UserControl();
            LuaInterfacer li = new LuaInterfacer();
            li.SetGlobal("UserControl", uc);
            li.DoFile("./Content/init.lua");
            scn = li.CreateStage(spriteBatch, "main");
            mainTheatre.AddStage(scn);
            scn.CalibrateCollisions();
            scn.Reindex();
            //ResourceLoader rsldr = new ResourceLoader("./Content/init.lua");
            mainHero = li.actorList["Hero"];
            //scn = rsldr.CreateStage(spriteBatch,"main");

            uc.onKeydown += keyDowned;
            uc.onMouseLeftDown += mouseMoved;

            IsMouseVisible = true;

            mainHero.onCollision += onCollision;
            mainHero.onMove += onActorMoved;
            mainHero.speed = 0.5f;
            mainHero.RotateSpeed = 100;
            scn.onMapOut += onSomebodyMapout;
            mainHero.Rotate((float)(Math.PI*2/3));
            //makeMoveTest(mainHero);
            systemFont = Content.Load<SpriteFont>("Courier New");
            Text t1 = new Text("main hero");
            t1.position.Y = -50;
            t1.position.X = -50;
            mainHero.AddText(t1);

            int middleDisplay = GraphicsDevice.Viewport.Width/2;
            menu = new Stage(this.spriteBatch, 1024, 768, new Rectangle(0,0,400, 400));

            Button newGameButton = new Button("New game", GraphicsDevice, spriteBatch);
            newGameButton.BackgroundImage = "Plit.png";
            newGameButton.onClick += NewGameFunc;

            Button exitButton = new Button("Exit", GraphicsDevice, spriteBatch);
            exitButton.BackgroundImage = "Plit.png";
            exitButton.onClick += ExitFunc;

            Panel p = new Panel(GraphicsDevice.Viewport.Width,GraphicsDevice.Viewport.Height);
            p.position.Y = 10;
            p.AddControl(newGameButton);
            p.AddControl(exitButton);

            menu.AddControl(p);

            mainTheatre.AddStage(menu);

            mainTheatre.Disable(scn);
            //mainTheatre.Disable(menu);
        }
Exemple #3
0
 public void Enable(Stage s)
 {
     for (int i = 0; i < stages.Count; i++)
         if (stages[i].value == s) stages[i].enable = true;
 }
Exemple #4
0
 public void Disable(Stage s)
 {
     for (int i = 0; i < stages.Count; i++)
         if (stages[i].value == s) stages[i].enable = false;
 }
 public Stage CreateStage(SpriteBatch sb, string mapName)
 {
     if (set.width <= 0) set.width = sb.GraphicsDevice.DisplayMode.Width;
         if (set.height <= 0) set.height = sb.GraphicsDevice.DisplayMode.Height;
         TileMap tm = this.mapList[mapName];
         Stage stg = new Stage(sb, tm.WidthTile, tm.HeightTile, new Rectangle(set.x, set.y, set.width, set.height));
         stg.Background = tm;
         stg.addActor(GetActorList());
         luaContext["stage" + stageNumber] = stg;
         return stg;
 }
Exemple #6
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            uc          = new UserControl();
            LuaInterfacer li = new LuaInterfacer();

            li.SetGlobal("UserControl", uc);
            li.DoFile("./Content/init.lua");
            scn = li.CreateStage(spriteBatch, "main");
            mainTheatre.AddStage(scn);
            scn.CalibrateCollisions();
            scn.Reindex();
            //ResourceLoader rsldr = new ResourceLoader("./Content/init.lua");
            mainHero = li.actorList["Hero"];
            //scn = rsldr.CreateStage(spriteBatch,"main");


            uc.onKeydown       += keyDowned;
            uc.onMouseLeftDown += mouseMoved;

            IsMouseVisible = true;

            mainHero.onCollision += onCollision;
            mainHero.onMove      += onActorMoved;
            mainHero.speed        = 0.5f;
            mainHero.RotateSpeed  = 100;
            scn.onMapOut         += onSomebodyMapout;
            mainHero.Rotate((float)(Math.PI * 2 / 3));
            //makeMoveTest(mainHero);
            systemFont = Content.Load <SpriteFont>("Courier New");
            Text t1 = new Text("main hero");

            t1.position.Y = -50;
            t1.position.X = -50;
            mainHero.AddText(t1);

            int middleDisplay = GraphicsDevice.Viewport.Width / 2;

            menu = new Stage(this.spriteBatch, 1024, 768, new Rectangle(0, 0, 400, 400));

            Button newGameButton = new Button("New game", GraphicsDevice, spriteBatch);

            newGameButton.BackgroundImage = "Plit.png";
            newGameButton.onClick        += NewGameFunc;

            Button exitButton = new Button("Exit", GraphicsDevice, spriteBatch);

            exitButton.BackgroundImage = "Plit.png";
            exitButton.onClick        += ExitFunc;

            Panel p = new Panel(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

            p.position.Y = 10;
            p.AddControl(newGameButton);
            p.AddControl(exitButton);

            menu.AddControl(p);

            mainTheatre.AddStage(menu);

            mainTheatre.Disable(scn);
            //mainTheatre.Disable(menu);
        }