static void Main() { //Get the splash screen graphic System.Windows.SplashScreen EngineSplashScreen = new System.Windows.SplashScreen("Resources/SplashScreen.jpg"); EngineSplashScreen.Show(true);//Show splash screen // initialize the main engine form EngineMessage("Intializing Pixel Engine", eEngineMessageType.NONE); form = new Form1(); form.Show(); // show our form LoadCfg(); //Load config files DrawingSurface rendersurface = new DrawingSurface(); rendersurface.Size = new System.Drawing.Size(form.Width, form.Height); rendersurface.Location = new System.Drawing.Point(0, 0); form.Controls.Add(rendersurface); EngineMessage("Pixel Engine Ready!", eEngineMessageType.CONFIRM); // initialize sfml SFML.Graphics.RenderWindow renderwindow = new SFML.Graphics.RenderWindow(rendersurface.Handle); //Main cam SFML.Graphics.View mainRenderView = new SFML.Graphics.View(new FloatRect(0, 0, 1920, 1080)); renderwindow.SetView(mainRenderView); //UI Cam SFML.Graphics.View uiRenderView = new SFML.Graphics.View(new FloatRect(0, 0, 1920, 1080)); _scene = new EditorScene(renderwindow, mainRenderView); //Initialize the resources form resourcesForm = new ResourcesForm(); resourcesForm.Size = new System.Drawing.Size(800, 600); resourcesForm.Location = new System.Drawing.Point(form.Location.X + form.Width, form.Location.Y); resourcesForm.Show(); resourcesForm.Disposed += new EventHandler(DisposedResourceForm); //Debug: create sprite PixelEngineProj.Gameplay.PixelSprite newSprite = new PixelEngineProj.Gameplay.PixelSprite("Resources/SpriteIcon.png", new IntRect(0, 0, 128, 128), new Vector2f(0, 0)); newSprite.Position = new Vector2f(0, 0); Text t = new Text("Testing", new Font("Resources/pixelmix.ttf")); // drawing loop while (form.Visible) { System.Windows.Forms.Application.DoEvents(); renderwindow.DispatchEvents(); renderwindow.Clear(new SFML.Graphics.Color(40, 40, 40)); //Draw main scene renderwindow.SetView(mainRenderView); _scene.Draw(renderwindow); renderwindow.SetView(uiRenderView); //Draw engine text renderwindow.SetView(uiRenderView); t.Position = new Vector2f(1700, 100); t.Draw(renderwindow, RenderStates.Default); renderwindow.Display(); rendersurface.Size = new System.Drawing.Size(form.Width - 300, form.Height); } }
public static void DisposedResourceForm(object sender, EventArgs args) { resourcesForm = null; }