DSC Engine
Loading...
Searching...
No Matches
measure.hpp
1#pragma once
2
3namespace DSC
4{
8 {
9 private:
10 int raw_value;
11 bool conversion_fit = false;
12 int block_cnt = 1;
13 public:
17 MeasureValue(int raw = 0);
18
22
26
36 MeasureValue& blocks(int quant);
37
41 int value() const;
42
46 int kilobytes() const;
47
48 operator int() const;
49
50 };
51
54 class Measure
55 {
56 private:
57 bool bmp = false;
58 bool rot = false;
59 int color_depth = 4;
60 int tile_w = 1;
61 int tile_h = 1;
62 public:
67
72
77
81 Measure& bpp(int color_depth);
82
88 Measure& metatile(int tw, int th);
89
93
97
105 MeasureValue tiles(int count) const;
106
115 MeasureValue tiles(int rows_count, int cols_count) const;
116
122 MeasureValue bitmap(int width, int height) const;
123
128 int tiles_count(int size) const;
129
130 MeasureValue map_size(int width, int height) const;
131
132 int bytes_per_map_entry() const;
133
134 int tile_id(void* address, void* base, int mapping_step) const;
135
136
137
138 };
139}
Helper class to deal with graphics size computations.
Definition: measure.hpp:55
Measure & _8bpp()
chain function to set color depth to 8 bpp
MeasureValue tiles(int count) const
computes the size of a number of tiles given the measure settings
MeasureValue tiles(int rows_count, int cols_count) const
computes the size of a matrix of tiles given the measure settings
int tiles_count(int size) const
finds how many tiles can fit in memory block of a certain size, given the measure settings
Measure & text()
chain function to set map type as text (tiles)
Measure & _16bpp()
chain function to set color depth to 16 bpp
MeasureValue bitmap(int width, int height) const
computes the size of a bitmap given the measure settings
Measure & metatile(int tw, int th)
chain function to set meta tile size
Measure & bitmap()
chain function to set map type as bitmap
Measure & bpp(int color_depth)
alternative to _4bpp(), _8bpp() or _16bpp() with dynamic parameter
Measure & _4bpp()
chain function to set color depth to 4 bpp
Wrapper around int to convert units.
Definition: measure.hpp:8
int kilobytes() const
converts the value of the measure in kilobytes. Roughly equivalent to MeasureValue::blocks(1024).
MeasureValue(int raw=0)
creates measure data from numeric value \raw numeric value
int value() const
gets the value of the measure, after applying the value modifier
MeasureValue & cut()
specifies to use the lower integer bound for non-integer value conversion
MeasureValue & fit()
specifies to use the upper integer bound for non-integer value conversion