/// <summary>
        /// 
        /// </summary>
        protected override void Initialize()
        {
            if (!initialized)
            {
                base.Initialize();

                content = new ContentManager(Services, @"Gibbo.Content");
                spriteBatch = new SpriteBatch(GraphicsDevice);

                //gameTime = new GameTime();
                Camera = new Camera();

                //SceneManager.Content = content;
                SceneManager.SpriteBatch = spriteBatch;
                SceneManager.GraphicsDevice = GraphicsDevice;
                SceneManager.ActiveCamera = this.Camera;

                EditorHandler.SelectedGameObjects = new List<GameObject>();

                // Load ObjectIcons
                objectIcons["AudioObject"] = TextureLoader.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\Gibbo.Content\\audio.png");

                FontFile fontFile = FontLoader.Load(AppDomain.CurrentDomain.BaseDirectory + "\\Gibbo.Content\\editorBMFont.fnt");
                Texture2D fontTexture = TextureLoader.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\Gibbo.Content\\editorBMFont_0.png");
                bmFontRenderer = new FontRenderer(fontFile, fontTexture);

                LoadContent();

                this.CenterCamera();

                initialized = true;

                this.MouseWheel += SceneEditorControl_MouseWheel;
            }
        }
Beispiel #2
0
        private void DrawCollisionView(Viewport viewport, Camera camera)
        {
            if ((SceneManager.IsEditor && SceneManager.GameProject.EditorSettings.ShowCollisions)
             || (!SceneManager.IsEditor && SceneManager.GameProject.Debug && SceneManager.GameProject.EditorSettings.ShowCollisions))
            {
                var projection = Matrix.CreateOrthographicOffCenter(
                   0f,
                   ConvertUnits.ToSimUnits(viewport.Width),
                   ConvertUnits.ToSimUnits(viewport.Height), 0f, 0f,
                   1f);

                var view = Matrix.CreateTranslation(
                        -ConvertUnits.ToSimUnits(camera.Position.X),
                        -ConvertUnits.ToSimUnits(camera.Position.Y), 0.0f) *
                    Matrix.CreateRotationZ(camera.Rotation) *
                    Matrix.CreateScale(
                        new Vector3((float)camera.Zoom,
                            (float)camera.Zoom, 1)) *
                    Matrix.CreateTranslation(
                        ConvertUnits.ToSimUnits(viewport.Width / 2),
                        ConvertUnits.ToSimUnits(viewport.Height / 2), 0.0f);

                debugView.RenderDebugData(ref projection, ref view);
            }
        }