Exemple #1
0
        static void Main(string[] args)
        {
            game = new Game();
            game.Start();
            StartupForm startup = new StartupForm();
            DialogResult startupResult;
            do
            {
                startupResult = startup.ShowDialog();
                if (startupResult == DialogResult.Abort)
                {
                    Application.Exit();
                    Environment.Exit(1);
                    return;
                }
            }
            while(startupResult == DialogResult.Cancel);

            app = new RenderWindow(new VideoMode(800, 600), "FTLEdit: Ship Editor", Styles.Default);
            app.Closed += new EventHandler(OnClosed);
            app.KeyPressed += new EventHandler<SFML.Window.KeyEventArgs>(OnKeyPressed);

            app.SetFramerateLimit(30);

            while (app.IsOpen())
            {
                app.DispatchEvents();
                app.Clear();
                game.Draw(app);
                game.Update();
                app.Display();
                if(game.cursorMode != CursorMode.PlacedBGCursor)
                    Application.DoEvents();
            }
        }
Exemple #2
0
        //GuiButton placeRoomRepair;
        //GuiButton placeRoomCombat;
        public void Start()
        {
            game = this;
            ship = new Ship();
            optWnd = new ShipProperties();
            gibs = new Sprite[6];
            //ShipRooms.Add(new FTLRoom(new Vector2i(0, 0), new Vector2i(1, 1)));
            //ShipRooms.Add(new FTLRoom(new Vector2i(2, 2), new Vector2i(1, 1)));
            //ShipRooms.Add(new FTLRoom(new Vector2i(3, 3), new Vector2i(1, 1)));
            //AddRoomBtn_n = new Sprite(new Texture("img/GUI/btns/addroom_n.png"));
            btnAddRoom = new GuiButton(new Vector2f(GUIStartX, 0), new Texture("img/GUI/btns/addroom_n.png"), new Texture("img/GUI/btns/addroom_s.png"));
            btnAddDoor = new GuiButton(new Vector2f(GUIStartX, 37), new Texture("img/GUI/btns/adddoor_n.png"), new Texture("img/GUI/btns/adddoor_s.png"));

            placeRoomCloaking = new GuiButton(new Vector2f(GUIStartX + 5, 65), new Texture("img/GUI/roomfuncs/s_cloaking_overlay.png"));
            placeRoomDoors = new GuiButton(new Vector2f(GUIStartX + 35, 65), new Texture("img/GUI/roomfuncs/s_doors_overlay.png"));
            placeRoomDrones = new GuiButton(new Vector2f(GUIStartX + 65, 65), new Texture("img/GUI/roomfuncs/s_drones_overlay.png"));
            placeRoomEngines = new GuiButton(new Vector2f(GUIStartX + 95, 65), new Texture("img/GUI/roomfuncs/s_engines_overlay.png"));
            placeRoomMedbay = new GuiButton(new Vector2f(GUIStartX + 5, 95), new Texture("img/GUI/roomfuncs/s_medbay_overlay.png"));
            placeRoomOxygen = new GuiButton(new Vector2f(GUIStartX + 35, 95), new Texture("img/GUI/roomfuncs/s_oxygen_overlay.png"));
            placeRoomPilot = new GuiButton(new Vector2f(GUIStartX + 65, 95), new Texture("img/GUI/roomfuncs/s_pilot_overlay.png"));
            placeRoomSensors = new GuiButton(new Vector2f(GUIStartX + 95, 95), new Texture("img/GUI/roomfuncs/s_sensors_overlay.png"));
            placeRoomShields = new GuiButton(new Vector2f(GUIStartX + 5, 125), new Texture("img/GUI/roomfuncs/s_shields_overlay.png"));
            placeRoomTeleporter = new GuiButton(new Vector2f(GUIStartX + 35, 125), new Texture("img/GUI/roomfuncs/s_teleporter_overlay.png"));
            placeRoomWeapons = new GuiButton(new Vector2f(GUIStartX + 65, 125), new Texture("img/GUI/roomfuncs/s_weapons_overlay.png"));
            //AddRoomBtn_s = new Sprite(new Texture("img/GUI/btns/addroom_s.png"));
            //AddDoorBtn_n = new Sprite(new Texture("img/GUI/btns/adddoor_n.png"));
            //AddDoorBtn_s = new Sprite(new Texture("img/GUI/btns/adddoor_s.png"));

            btnOptions = new GuiButton(new Vector2f(GUIStartX, 560), new Texture("img/GUI/btns/options.png"));
            //btnLoad = new GuiButton(new Vector2f(GUIStartX, 150), new Texture("img/GUI/btns/load_n.png"), new Texture("img/GUI/btns/load_s.png"));
            btnLoadFloor = new GuiButton(new Vector2f(GUIStartX, 250), new Texture("img/GUI/btns/loadfloor_n.png"), new Texture("img/GUI/btns/loadfloor_s.png"));
            btnLoadBase = new GuiButton(new Vector2f(GUIStartX, 250 + 37), new Texture("img/GUI/btns/loadbase_n.png"), new Texture("img/GUI/btns/loadbase_s.png"));
            btnToggleFloor = new GuiButton(new Vector2f(GUIStartX, 350), new Texture("img/GUI/btns/showfloor_n.png"), new Texture("img/GUI/btns/showfloor_s.png"));
            btnToggleBase = new GuiButton(new Vector2f(GUIStartX, 350 + 37), new Texture("img/GUI/btns/showbase_n.png"), new Texture("img/GUI/btns/showbase_s.png"));

            btnMoveBG = new GuiButton(new Vector2f(GUIStartX, 400 + 37), new Texture("img/GUI/btns/movebg_n.png"), new Texture("img/GUI/btns/movebg_s.png"));
            btnMoveGibs = new GuiButton(new Vector2f(GUIStartX, 400 + (37 * 2)), new Texture("img/GUI/btns/movegibs_n.png"), new Texture("img/GUI/btns/movegibs_s.png"));
            //LoadBtn_n = new Sprite(new Texture("img/GUI/btns/load_n.png"));
            //LoadBtn_s = new Sprite(new Texture("img/GUI/btns/load_s.png"));
            ViewOffsetter = new Sprite(new Texture("img/GUI/btns/viewshift.png"));
            ViewOffsetter.Position = new Vector2f(GUIStartX + 40, 200);
            //AddRoomBtn_n.Position = new Vector2f(GUIStartX, 0);
            //AddRoomBtn_s.Position = new Vector2f(GUIStartX + 2, 2);
            //AddDoorBtn_n.Position = new Vector2f(GUIStartX, 37);
            //AddDoorBtn_s.Position = new Vector2f(GUIStartX + 2, 37 + 2);
            //LoadBtn_n.Position = new Vector2f(GUIStartX, 140);

            verts[0] = new Vertex();
            verts[1] = new Vertex();
            verts[0].Color = new Color(100, 100, 100, 100);
            verts[1].Color = new Color(100, 100, 100, 100);

            roomFuncs = new List<RoomFunc>();
            roomFuncs.Add(new RoomFunc("pilot", new Texture("img/GUI/roomfuncs/s_pilot_overlay.png"), null));
            roomFuncs.Add(new RoomFunc("doors", new Texture("img/GUI/roomfuncs/s_doors_overlay.png"), null));
            roomFuncs.Add(new RoomFunc("sensors", new Texture("img/GUI/roomfuncs/s_sensors_overlay.png"), null));
            roomFuncs.Add(new RoomFunc("oxygen", new Texture("img/GUI/roomfuncs/s_oxygen_overlay.png"), null));
            roomFuncs.Add(new RoomFunc("engines", new Texture("img/GUI/roomfuncs/s_engines_overlay.png"), null));
            roomFuncs.Add(new RoomFunc("shields", new Texture("img/GUI/roomfuncs/s_shields_overlay.png"), null));
            roomFuncs.Add(new RoomFunc("weapons", new Texture("img/GUI/roomfuncs/s_weapons_overlay.png"), null));
            roomFuncs.Add(new RoomFunc("drones", new Texture("img/GUI/roomfuncs/s_drones_overlay.png"), null));
            roomFuncs.Add(new RoomFunc("medbay", new Texture("img/GUI/roomfuncs/s_medbay_overlay.png"), null));
            roomFuncs.Add(new RoomFunc("teleporter", new Texture("img/GUI/roomfuncs/s_teleporter_overlay.png"), null));
            roomFuncs.Add(new RoomFunc("cloaking", new Texture("img/GUI/roomfuncs/s_cloaking_overlay.png"), null));
        }