coastline 0.0.4
Loading...
Searching...
No Matches
textfont.h
Go to the documentation of this file.
1#pragma once
2
8
9#include <array>
10#include <memory>
11#include <optional>
12
13#include "scenerenderer.h"
14#include "textgrid.h"
15
16namespace coastline {
17
19inline constexpr int GRID_WIDTH = GRID_COLUMNS * CELL_WIDTH;
20
22inline constexpr int GRID_HEIGHT = GRID_ROWS * CELL_HEIGHT;
23
30
43GridPointInWindow(float windowWidth, float windowHeight, float frameAspect, float x, float y);
44
46class TextFont {
47public:
55
63 void Draw(SceneRenderer &renderer,
64 const TextGrid &grid,
65 std::optional<std::array<int, 2>> pointer) const;
66
67private:
68 TextFont() = default;
71};
72
73} // namespace coastline
The renderer of a frame.
Definition scenerenderer.h:467
void Draw(SceneRenderer &renderer, const TextGrid &grid, std::optional< std::array< int, 2 > > pointer) const
Draw every cell of the grid and its text cursor, and the pointer last over them.
static std::unique_ptr< TextFont > Create(SceneRenderer &renderer)
Upload the glyphs of unscii-16 and the pointer.
The cells of the screen and the place of the text cursor.
Definition textgrid.h:99
Definition assetimport.h:11
Matrix4 TextGridProjection(float aspect)
constexpr int CELL_WIDTH
The width of a cell in pixels.
Definition textgrid.h:24
constexpr int GRID_WIDTH
The width of the grid in pixels, 640.
Definition textfont.h:19
constexpr int GRID_HEIGHT
The height of the grid in pixels, 400.
Definition textfont.h:22
constexpr int CELL_HEIGHT
The height of a cell in pixels.
Definition textgrid.h:27
std::array< float, 16 > Matrix4
A 4 by 4 matrix, column by column.
Definition scenerenderer.h:28
constexpr int GRID_ROWS
The rows of the grid.
Definition textgrid.h:21
constexpr int GRID_COLUMNS
The columns of the grid.
Definition textgrid.h:18
std::array< int, 2 > GridPointInWindow(float windowWidth, float windowHeight, float frameAspect, float x, float y)
The place of the mouse on the grid, with the frame fitted to the window and the grid to the frame as ...
The renderer of the converted models and of flat pictures and text, on the GPU of SDL.
A text-mode screen of 80 by 25 cells, each a character of code page 437 with a foreground and a backg...