Esempio n. 1
0
        public Memory(int width, int height)
        {
            DisplayMode   = DisplayMode.Text;
            TextBuffer    = new TextBuffer(width, height);
            SysFont       = new SysFont();
            DisplayBuffer = new DisplayBuffer(width, height);
            Pallete       = new Pallete();

            InputBuffer = new InputBuffer();

            SpriteBuffer = new SpriteBuffer();
            CodeBuffer   = string.Empty;
        }
Esempio n. 2
0
    public void Init(Camera camera)
    {
        renderCamera = camera;

        spriteBufferObject = new SpriteBuffer();
        spriteBufferObject.renderCamera = camera;

        meshBufferObject = new MeshBuffer();
        meshBufferObject.renderCamera = camera;

        spriteShapeBufferObject = new SpriteShapeBuffer();
        spriteShapeBufferObject.renderCamera = camera;

        tilemapBufferObject = new TilemapBuffer();
        tilemapBufferObject.renderCamera = camera;
    }
Esempio n. 3
0
        void window_Load(object sender, EventArgs e)
        {
            this.GraphicsContext = new DebugGraphicsContext(new OpenGLGraphicsContext());
            var locator = new ServiceLocator();

            locator.RegisterService <IGraphicsContext>(this.GraphicsContext);

            var resourceLoader = new ResourceLoader();

            resourceLoader.AddImportersAndProcessors(typeof(ResourceLoader).Assembly);

            this.Resourses = new ResourceContext(locator, new TypeReaderFactory(), new TypeWriterFactory(), resourceLoader,
                                                 Path.Combine(this.resourceFolder, "Assets"), this.resourceFolder);
            this.Resourses.ShouldSaveAllLoadedAssets = false;

            pixel = this.Resourses.LoadAsset <TextureAtlas>("Fonts\\Metro_W_Pixel.atlas")["pixel"];
            var effect = this.Resourses.LoadAsset <ShaderProgram>("Basic.effect");

            this.spriteBuffer = new SpriteBuffer(this.GraphicsContext, effect);
            this.guiRenderer  = new GUIRenderer(this.spriteBuffer, pixel);


            window.VSync = VSyncMode.Off;
            window.Keyboard.KeyRepeat = true;

            // Other state
            GraphicsContext.Enable(EnableCap.Blend);
            GraphicsContext.Enable(EnableCap.ScissorTest);
            GraphicsContext.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);

            var factory = CreateGUIFactory();

            this.Load(factory);

            clock = new Clock();
        }
        void window_Load(object sender, EventArgs e)
        {
            this.GraphicsContext = new DebugGraphicsContext(new OpenGLGraphicsContext());
            var locator = new ServiceLocator();
            locator.RegisterService<IGraphicsContext>(this.GraphicsContext);

            var resourceLoader = new ResourceLoader();
            resourceLoader.AddImportersAndProcessors(typeof(ResourceLoader).Assembly);

            this.Resourses = new ResourceContext(locator, new TypeReaderFactory(), new TypeWriterFactory(), resourceLoader,
                                                        Path.Combine(this.resourceFolder, "Assets"), this.resourceFolder);
            this.Resourses.ShouldSaveAllLoadedAssets = false;

            pixel = this.Resourses.LoadAsset<TextureAtlas>("Fonts\\Metro_W_Pixel.atlas")["pixel"];
            var effect = this.Resourses.LoadAsset<ShaderProgram>("Basic.effect");
            this.spriteBuffer = new SpriteBuffer(this.GraphicsContext, effect);
            this.guiRenderer = new GUIRenderer(this.spriteBuffer, pixel);

            window.VSync = VSyncMode.Off;
            window.Keyboard.KeyRepeat = true;

            // Other state
            GraphicsContext.Enable(EnableCap.Blend);
            GraphicsContext.Enable(EnableCap.ScissorTest);
            GraphicsContext.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);

            var factory = CreateGUIFactory();
            this.Load(factory);

            clock = new Clock();
        }
Esempio n. 5
0
 public GraphicsDriver(Memory mem)
 {
     _mem           = mem;
     _spriteBuffer  = mem.SpriteBuffer;
     _displayBuffer = mem.DisplayBuffer;
 }