Exemplo n.º 1
0
        internal static RenderSurface CreateRenderSurface(int index, int width, int height)
        {
            var render_surface = new RenderSurface(index, width, height);

            _runtime_assets.Add(render_surface);
            return(render_surface);
        }
Exemplo n.º 2
0
        public static void PresentDrawSurface(RenderSurface draw_surface)
        {
            _ = SDL_LockTexture(_render_texture, IntPtr.Zero, out var pixels, out _);
            unsafe
            {
                Unsafe.CopyBlockUnaligned((void *)pixels, (void *)draw_surface.DataPtr, draw_surface.ByteCount);
            }
            SDL_UnlockTexture(_render_texture);
            _ = SDL_RenderCopy(_graphics_context, _render_texture, IntPtr.Zero, IntPtr.Zero);

            SDL_RenderPresent(_graphics_context);
        }
Exemplo n.º 3
0
        internal Canvas(int width, int height)
        {
            Width = width;

            Height = height;

            _available_palettes = new Palette[]
            {
                Palettes.Journey,
                Palettes.Famicube
            };

            _base_palette         = Palettes.Journey;
            _blit_surface         = Assets.CreatePixmap(width, height);
            _current_blit_surface = _blit_surface;
            _clip_rect            = new Rect(0, 0, width, height);
            //_render_surface_stack = new RenderSurface[RENDER_STACK_SIZE];
            _render_surface = Assets.CreateRenderSurface(0, width, height);
            _palette_stack  = new int[RENDER_STACK_SIZE];
        }