Example #1
0
        public static void DrawChar(Vector3 pos, float char_size, char ch)
        {
            var rect     = new Rectangle(pos, char_size / 2, char_size / 2);
            var glyph_uv = GLRenderer.CharToFontUV(ch);

            GLRenderer.DrawTexture(GLRenderer.font_texture, rect, glyph_uv, glyph_uv + GlyphUVOffset);
        }
Example #2
0
        public void Render(Tileset tileset)
        {
            int   tile_idx  = 0;
            var   uv_offset = new Vector2(1.0f / tileset.width, 1.0f / tileset.height);
            float tile_y    = origin.Y + (height * tile_size / 2);

            for (int y = height - 1; y >= 0; y--)
            {
                float tile_x = origin.X - (width * tile_size / 2);;

                for (int x = 0; x < width; x++)
                {
                    var uv_start = tileset.GetTileUV(tiles[tile_idx]);

                    var left_bottom = new Vector3(tile_x, tile_y, 0);
                    var top_right   = new Vector3(tile_x + tile_size, tile_y - tile_size, 0);

                    GLRenderer.DrawTexture(tileset.texture, left_bottom, top_right, uv_start, uv_start + uv_offset);

                    tile_x += tile_size;
                    tile_idx++;
                }

                tile_y -= tile_size;
            }
        }