예제 #1
0
        public virtual void OnLoad(EventArgs e)
        {
            _time.Start();

            if (!IsHeadless)
            {
                Renderer = new Renderer(CanvasSize);

                // Load textures from file
                Renderer.Textures.Add("default.png", new TextureFile(Path.Combine(textureFolder, "default.png")));
                Renderer.Textures.Add("grid.png", new TextureFile(Path.Combine(textureFolder, "grid.png")));
                Renderer.Textures.Add("lineBlur.png", new TextureFile(Path.Combine(textureFolder, "lineBlur.png")));

                //Create the default font
                System.Drawing.Text.PrivateFontCollection privateFonts = new System.Drawing.Text.PrivateFontCollection();
                privateFonts.AddFontFile(Path.Combine(fontFolder, "times.ttf"));
                Default = new Font(privateFonts.Families[0], 14);
                FontRenderer = new FontRenderer(Default);

                // Load shaders from file
                Renderer.Shaders.Add("uber", new Shader(
                    Path.Combine(shaderFolder, "vs_uber.glsl"),
                    Path.Combine(shaderFolder, "fs_uber.glsl"),
                    true));

                SoundEnabled = false;
                if (SoundEnabled)
                {
                    SoundSystem = new SoundSystem();
                    SoundSystem.Initialize();
                    SoundSystem.Start();
                }
            }

            /*if (programArgs.Length == 1)
            {
                Serializer serializer = new Serializer();
                Scene scene = serializer.Deserialize(programArgs[0]);
                scene.SetActiveCamera(new Camera2(scene, new Transform2(new Vector2(), 10), CanvasSize.Width / (float)CanvasSize.Height));
                Renderer.AddLayer(scene);
                Portals.PortalCommon.UpdateWorldTransform(scene);
                if (programArgs[0].StartsWith(tempLevelPrefix))
                {
                    File.Delete(programArgs[0]);
                }
            }*/
        }
예제 #2
0
 public CharData(Rectangle pixelRegion, FontRenderer fontRenderer)
 {
     _pixelRegion = pixelRegion;
     _fontRenderer = fontRenderer;
 }