static MainCanvas() { Camera = new Camera2D(); GraphicsManager.keyboard.KeyDown += Keyboard_KeyDown; GraphicsManager.keyboard.KeyUp += Keyboard_KeyUp; GraphicsManager.mouse.ButtonDown += Mouse_ButtonDown; GraphicsManager.mouse.ButtonUp += Mouse_ButtonUp; GraphicsManager.mouse.Move += Mouse_Move; GraphicsManager.mouse.WheelChanged += Mouse_Wheel; Camera.OnRender += OnRenderFrame; Camera.Layer = 10; GraphicsManager.Update += OnUpdateFrame; GraphicsManager.OnWindowResize += new GraphicsManager.Resizer(OnWindowResize); GraphicsManager.OnDispose += new GraphicsManager.Disposer(Dispose); Renderer = new Gwen.Renderer.OpenTK(); Skin = new Gwen.Skin.TexturedBase(Renderer, @"Data\DefaultSkin.png"); canvas = new Canvas(Skin); input = new Gwen.Input.OpenTK(GraphicsManager.Instance); input.Initialize(canvas); canvas.SetSize(GraphicsManager.WindowWidth, GraphicsManager.WindowHeight); canvas.ShouldDrawBackground = false; canvas.BackgroundColor = System.Drawing.Color.FromArgb(255, 150, 170, 170); }
public FloatingCamera(Player Player1, Player Player2) { this.Player1 = Player1; this.Player2 = Player2; GraphicsManager.Update += GraphicsManager_Update; Camera = new Camera2D(); Camera.OnRender += new GraphicsManager.Renderer(Camera_OnRender); }
static void Main(string[] args) { Camera2D Primary = new Camera2D(); Primary.OnRender += new GraphicsManager.Renderer(Primary_OnRender); GraphicsManager.SetTitle("Heroes of Diamondfall"); GraphicsManager.SetResolution(800, 600); GraphicsManager.EnableMipmap = false; GraphicsManager.Update += new GraphicsManager.Updater(GraphicsManager_Update); Initialize(); GraphicsManager.Start(); }
public static void Main(string[] args) { //GraphicsManager.SetWindowState(OpenTK.WindowState.Maximized); GraphicsManager.SetTitle("Xanatos"); GraphicsManager.SetBackground(Color.Black); GraphicsManager.Update += GraphicsManager_Update; //Draw2D Camera2D = new Camera2D(); Camera2D.OnRender += Draw2D; Initialize(); GraphicsManager.Start(); }
public void Initialize() { /* Pokemon Slots */ PokemonSlots = new PokemonSlot[SlotXCount, SlotYCount]; for (int x = 0; x < SlotXCount; x++) { for (int y = 0; y < SlotYCount; y++) { PokemonSlots[x, y] = new PokemonSlot(); PokemonSlots[x, y].Size = SlotSize; PokemonSlots[x, y].Position = new Vector2(((SlotSize.X + SlotSeperation.X) * x) + SlotOffset.X, ((SlotSize.Y + SlotSeperation.Y) * y) + SlotOffset.Y); } } //Portraits int xslot = 0; int yslot = 0; foreach (var kvp in PokemonManager.Pokemons) { string Name = kvp.Key; Pokemon pokemon = kvp.Value; Animation2D anim = new Animation2D(pokemon.Animation); anim.state.SetAnimation("idle", true); PokemonSlots[xslot, yslot].Pokemon = pokemon; PokemonSlots[xslot, yslot].Animation = anim; if (++xslot >= SlotXCount) { xslot = 0; yslot++; } } CursorPosition p1c = new CursorPosition(0, 0, SlotXCount - 1, SlotYCount - 1); CursorPosition p2c = new CursorPosition(4, 0, SlotXCount - 1, SlotYCount - 1); if (preselect) { for (int x = 0; x < SlotXCount; x++) { for (int y = 0; y < SlotYCount; y++) { if (PokemonSlots[x, y].Pokemon == null) { continue; } if (PokemonSlots[x, y].Pokemon.Name == player1pre) { p1c.X = x; p1c.Y = y; } if (PokemonSlots[x, y].Pokemon.Name == player2pre) { p2c.X = x; p2c.Y = y; } } } } cursors = new PlayerCursor[2]; cursors[0] = new PlayerCursor(0, p1c, Controls.Player1, @"Data\Pokeball.png", @"Data\RedSlot.png", new Vector2(0, 1)); cursors[1] = new PlayerCursor(1, p2c, Controls.Player2, @"Data\Greatball.png", @"Data\BlueSlot.png", new Vector2(1, 1)); Camera = new Camera2D(); Camera.OnRender += new GraphicsManager.Renderer(Draw); MoveLists[0] = new MoveList(); MoveLists[1] = new MoveList(); }
static void Main(string[] args) { GraphicsManager.SetResolution(1280, 800); GraphicsManager.SetTitle("Capture Test"); GraphicsManager.Instance.X = DisplayDevice.GetDisplay(DisplayIndex.Second).Bounds.X; GraphicsManager.Instance.Y = DisplayDevice.GetDisplay(DisplayIndex.Second).Bounds.Y; if (ChangeResolution) { DisplayDevice.GetDisplay(DisplayIndex.Second).ChangeResolution(1280, 800, 32, 60.0f); } GraphicsManager.SetWindowState(OpenTK.WindowState.Fullscreen); Camera2D cam2d = new Camera2D(); cam2d.OnRender += Draw2D; GraphicsManager.Update += new Action(GraphicsManager_Update); var x = RiftSharp.RiftHeadsetDevice.FindRiftDevice(); x.OnMoveHead += MoveHead; cap = new DxScreenCapture(); GraphicsManager.Start(); if (ChangeResolution) { DisplayDevice.GetDisplay(DisplayIndex.Second).RestoreResolution(); } }
public static void Main(string[] args) { g_testEntries = AllTests.GetTests(); testCount = g_testEntries.Count(); testIndex = Math.Max(0, Math.Min(testIndex, testCount - 1)); testSelection = testIndex; entry = g_testEntries[testIndex]; test = entry.createFcn(); GraphicsManager.SetWindowState(OpenTK.WindowState.Maximized); string title = String.Format("Box2D Version {0}.{1}.{2}", Settings._version.major, Settings._version.minor, Settings._version.revision); GraphicsManager.SetTitle(title); camera = new Camera2D(); camera.OnRender += SimulationLoop; camera.SetZoom(12); camera.CenterOnTarget(true); camera.SetLocation(0, 0); GraphicsManager.Update += new GraphicsManager.Updater(GraphicsManager_Update); WindowControl glui = new WindowControl(MainCanvas.GetCanvas()); glui.Dock = Gwen.Pos.Left; Label text = new Label(glui); text.Text = "Tests"; text.SetPosition(10, 10); testList = new ListBox(glui); testList.RowSelected += delegate(Base sender, ItemSelectedEventArgs tlargs) { testSelection = testList.SelectedRowIndex; }; foreach (TestEntry e in g_testEntries) { testList.AddRow(e.name, "", e); } testList.SelectedRowIndex = testSelection; testList.SetPosition(10, 30); testList.SetSize(170, 180); //glui.add_separator(); Base SettingsBox = new Base(glui); SettingsBox.SetSize(200, 185); SettingsBox.SetPosition(0, 250); { NumericUpDown spinner = new NumericUpDown(SettingsBox); spinner.Text = "Vel Iters"; spinner.Min = 1; spinner.Max = 500; spinner.ValueChanged += delegate(Base sender, EventArgs vcargs) { settings.velocityIterations = (int)spinner.Value; }; spinner.Value = settings.velocityIterations; spinner.SetPosition(10, 10); NumericUpDown posSpinner = new NumericUpDown(SettingsBox); posSpinner.Min = 0; posSpinner.Max = 100; posSpinner.Text = "Pos Iters"; posSpinner.ValueChanged += delegate(Base sender, EventArgs psargs) { settings.positionIterations = (int)posSpinner.Value; }; posSpinner.Value = settings.positionIterations; posSpinner.SetPosition(10, 35); NumericUpDown hertzSpinner = new NumericUpDown(SettingsBox); hertzSpinner.Text = "Hertz"; hertzSpinner.Min = 5; hertzSpinner.Max = 200; hertzSpinner.ValueChanged += delegate(Base sender, EventArgs hargs) { settingsHz = hertzSpinner.Value; }; hertzSpinner.Value = settingsHz; hertzSpinner.SetPosition(10, 60); LabeledCheckBox scb = new LabeledCheckBox(SettingsBox); scb.Text = "Sleep"; scb.CheckChanged += delegate(Base sender, EventArgs argsscb) { settings.enableSleep = scb.IsChecked; }; scb.IsChecked = settings.enableSleep; scb.SetPosition(10, 85); LabeledCheckBox wsu = new LabeledCheckBox(SettingsBox); wsu.Text = "Warm Starting"; wsu.CheckChanged += delegate(Base sender, EventArgs argsscb) { settings.enableWarmStarting = wsu.IsChecked; }; wsu.IsChecked = settings.enableWarmStarting; wsu.SetPosition(10, 110); LabeledCheckBox toi = new LabeledCheckBox(SettingsBox); toi.Text = "Time of Impact"; toi.CheckChanged += delegate(Base sender, EventArgs argsscb) { settings.enableContinuous = toi.IsChecked; }; toi.IsChecked = settings.enableContinuous; toi.SetPosition(10, 135); LabeledCheckBox ssb = new LabeledCheckBox(SettingsBox); ssb.Text = "Sub-Stepping"; ssb.CheckChanged += delegate(Base sender, EventArgs argsscb) { settings.enableSubStepping = ssb.IsChecked; }; ssb.IsChecked = settings.enableSubStepping; ssb.SetPosition(10, 160); } Base drawPanel = new Base(glui); drawPanel.Dock = Gwen.Pos.Bottom; drawPanel.SetSize(200, 225); { LabeledCheckBox cbShapes = new LabeledCheckBox(drawPanel); cbShapes.Text = "Shapes"; cbShapes.IsChecked = settings.drawShapes; cbShapes.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawShapes = cbShapes.IsChecked; }; cbShapes.SetPosition(10, 10); //glui.add_checkbox_to_panel(drawPanel, "Joints", &settings.drawJoints); LabeledCheckBox cbJoints = new LabeledCheckBox(drawPanel); cbJoints.Text = "Joints"; cbJoints.IsChecked = settings.drawJoints; cbJoints.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawJoints = cbJoints.IsChecked; }; cbJoints.SetPosition(10, 30); //glui.add_checkbox_to_panel(drawPanel, "AABBs", &settings.drawAABBs); LabeledCheckBox cbAABBs = new LabeledCheckBox(drawPanel); cbAABBs.Text = "AABBs"; cbAABBs.IsChecked = settings.drawAABBs; cbAABBs.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawAABBs = cbAABBs.IsChecked; }; cbAABBs.SetPosition(10, 50); //glui.add_checkbox_to_panel(drawPanel, "Contact Points", &settings.drawContactPoints); LabeledCheckBox cbPoints = new LabeledCheckBox(drawPanel); cbPoints.Text = "Contact Points"; cbPoints.IsChecked = settings.drawContactPoints; cbPoints.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawContactPoints = cbPoints.IsChecked; }; cbPoints.SetPosition(10, 70); //glui.add_checkbox_to_panel(drawPanel, "Contact Normals", &settings.drawContactNormals); LabeledCheckBox cbNormals = new LabeledCheckBox(drawPanel); cbNormals.Text = "Contact Normals"; cbNormals.IsChecked = settings.drawContactNormals; cbNormals.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawContactNormals = cbNormals.IsChecked; }; cbNormals.SetPosition(10, 90); //glui.add_checkbox_to_panel(drawPanel, "Contact Impulses", &settings.drawContactImpulse); LabeledCheckBox cbImpulses = new LabeledCheckBox(drawPanel); cbImpulses.Text = "Contact Impulses"; cbImpulses.IsChecked = settings.drawContactImpulse; cbImpulses.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawContactImpulse = cbImpulses.IsChecked; }; cbImpulses.SetPosition(10, 110); //glui.add_checkbox_to_panel(drawPanel, "Friction Impulses", &settings.drawFrictionImpulse); LabeledCheckBox cbFriction = new LabeledCheckBox(drawPanel); cbFriction.Text = "Friction Impulses"; cbFriction.IsChecked = settings.drawFrictionImpulse; cbFriction.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawFrictionImpulse = cbFriction.IsChecked; }; cbFriction.SetPosition(10, 130); //glui.add_checkbox_to_panel(drawPanel, "Center of Masses", &settings.drawCOMs); LabeledCheckBox cbMasses = new LabeledCheckBox(drawPanel); cbMasses.Text = "Center of Masses"; cbMasses.IsChecked = settings.drawCOMs; cbMasses.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawCOMs = cbMasses.IsChecked; }; cbMasses.SetPosition(10, 150); //glui.add_checkbox_to_panel(drawPanel, "Statistics", &settings.drawStats); LabeledCheckBox cbStatistics = new LabeledCheckBox(drawPanel); cbStatistics.Text = "Statistics"; cbStatistics.IsChecked = settings.drawStats; cbStatistics.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawStats = cbStatistics.IsChecked; }; cbStatistics.SetPosition(10, 170); //glui.add_checkbox_to_panel(drawPanel, "Profile", &settings.drawProfile); LabeledCheckBox cbProfile = new LabeledCheckBox(drawPanel); cbProfile.Text = "Profile"; cbProfile.IsChecked = settings.drawProfile; cbProfile.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawProfile = cbProfile.IsChecked; }; cbProfile.SetPosition(10, 190); } Base Buttons = new Base(glui); Buttons.Dock = Gwen.Pos.Bottom; Buttons.Height = 100; { Button btnPause = new Button(Buttons); btnPause.Text = "Pause"; btnPause.IsToggle = true; btnPause.SetPosition(10, 10); btnPause.ToggleState = settings.pause; btnPause.Clicked += delegate(Base sender, ClickedEventArgs evargs) { settings.pause = btnPause.ToggleState; }; Button btnSS = new Button(Buttons); btnSS.Text = "Single Step"; btnSS.SetPosition(10, 40); btnSS.Clicked += delegate(Base sender, ClickedEventArgs evargs) { SingleStep(); }; Button btnRestart = new Button(Buttons); btnRestart.Text = "Restart"; btnRestart.SetPosition(10, 70); btnRestart.Clicked += delegate(Base sender, ClickedEventArgs evargs) { Restart(); }; } glui.SetSize(200, 300); GraphicsManager.Start(); }
static void Main(string[] args) { /* Set up Graphics Manager */ GraphicsManager.EnableMipmap = false; GraphicsManager.UseExperimentalFullAlpha = true; GraphicsManager.SetTitle("FantasyScape"); GraphicsManager.SetWindowState(OpenTK.WindowState.Maximized); GraphicsManager.SetBackground(Color.FromArgb(200, 200, 255)); GraphicsManager.Update += Update; GraphicsManager.Render += Draw; Overlay = new Camera2D(); Overlay.Layer = 1; //Draw behind everything Overlay.OnRender += Draw2D; /* Create Game World */ menu = new MenuManager(); escapemenu = new EscapeMenuManager(); DevelopmentMenu.Hidden = true; /* Start Game */ GraphicsManager.Start(); /* Hack: Clean up, this should be done automatically - GWEN, I'm looking at you >:| */ MainCanvas.Dispose(); }