Exemplo n.º 1
0
        internal Font(PicoGfx gfx, Pixmap pixmap)
        {
            GlyphQuadMap = new Dictionary <int, SDL.SDL_Rect>();

            FontSurface = new PicoSurface(gfx, pixmap, PicoSurface.AccessType.Static);

            LoadGlyphMap();
        }
Exemplo n.º 2
0
        internal PicoSurface(PicoGfx gfx, int width, int height, AccessType accessType)
        {
            _pixmap = new Pixmap(width, height);

            SDL.SDL_TextureAccess textureAccess;

            switch (accessType)
            {
            case AccessType.Static: textureAccess = SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_STATIC; break;

            case AccessType.Dynamic: textureAccess = SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_STREAMING; break;

            case AccessType.Target: textureAccess = SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_TARGET; break;

            default: textureAccess = SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_STATIC; break;
            }

            _texture = SDL.SDL_CreateTexture(gfx.Context, SDL.SDL_PIXELFORMAT_ARGB8888,
                                             (int)textureAccess, width, height);

            SDL.SDL_UpdateTexture(_texture, IntPtr.Zero, _pixmap.DataPtr, _pixmap.Pitch);
        }
Exemplo n.º 3
0
        internal PicoSurface(PicoGfx gfx, Pixmap pixmap, AccessType accessType)
        {
            _pixmap = pixmap;

            SDL.SDL_TextureAccess textureAccess;

            switch (accessType)
            {
            case AccessType.Static: textureAccess = SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_STATIC; break;

            case AccessType.Dynamic: textureAccess = SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_STREAMING; break;

            case AccessType.Target: textureAccess = SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_TARGET; break;

            default: textureAccess = SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_STATIC; break;
            }

            _texture = SDL.SDL_CreateTexture(gfx.Context, SDL.SDL_PIXELFORMAT_ARGB8888,
                                             (int)textureAccess, pixmap.Width, pixmap.Height);

            SDL.SDL_SetTextureBlendMode(_texture, SDL.SDL_BlendMode.SDL_BLENDMODE_BLEND);

            SDL.SDL_UpdateTexture(_texture, IntPtr.Zero, _pixmap.DataPtr, _pixmap.Pitch);
        }