yaze
0.3.2
Link to the Past ROM Editor
Loading...
Searching...
No Matches
tile16_editor_action_state.h
Go to the documentation of this file.
1
#ifndef YAZE_APP_EDITOR_OVERWORLD_TILE16_EDITOR_ACTION_STATE_H
2
#define YAZE_APP_EDITOR_OVERWORLD_TILE16_EDITOR_ACTION_STATE_H
3
4
#include <algorithm>
5
6
namespace
yaze
{
7
namespace
editor {
8
9
struct
Tile16ActionControlState
{
10
bool
can_write_pending
=
false
;
11
bool
can_discard_all
=
false
;
12
bool
can_discard_current
=
false
;
13
bool
can_undo
=
false
;
14
bool
can_redo
=
false
;
15
};
16
17
inline
Tile16ActionControlState
ComputeTile16ActionControlState
(
18
bool
has_pending,
bool
current_tile_pending,
bool
can_undo,
bool
can_redo) {
19
Tile16ActionControlState
state;
20
state.
can_write_pending
= has_pending;
21
state.
can_discard_all
= has_pending;
22
state.
can_discard_current
= current_tile_pending;
23
state.
can_undo
= can_undo;
24
state.
can_redo
= can_redo;
25
return
state;
26
}
27
28
inline
int
ComputeTile16CompactActionColumnCount
(
float
available_width_px) {
29
if
(available_width_px >= 900.0f) {
30
return
7;
31
}
32
if
(available_width_px >= 620.0f) {
33
return
5;
34
}
35
if
(available_width_px >= 420.0f) {
36
return
3;
37
}
38
if
(available_width_px >= 260.0f) {
39
return
2;
40
}
41
return
1;
42
}
43
44
inline
int
ComputeTile16ActionRowCount
(
int
action_count,
int
column_count) {
45
if
(action_count <= 0) {
46
return
0;
47
}
48
if
(column_count <= 0) {
49
column_count = 1;
50
}
51
return
(action_count + column_count - 1) / column_count;
52
}
53
54
inline
float
ComputeTile16PaletteButtonSize
(
float
available_width_px) {
55
if
(available_width_px <= 0.0f) {
56
return
24.0f;
57
}
58
return
std::clamp((available_width_px - 16.0f) / 4.0f, 24.0f, 32.0f);
59
}
60
61
}
// namespace editor
62
}
// namespace yaze
63
64
#endif
// YAZE_APP_EDITOR_OVERWORLD_TILE16_EDITOR_ACTION_STATE_H
yaze::editor::ComputeTile16CompactActionColumnCount
int ComputeTile16CompactActionColumnCount(float available_width_px)
Definition
tile16_editor_action_state.h:28
yaze::editor::ComputeTile16PaletteButtonSize
float ComputeTile16PaletteButtonSize(float available_width_px)
Definition
tile16_editor_action_state.h:54
yaze::editor::ComputeTile16ActionControlState
Tile16ActionControlState ComputeTile16ActionControlState(bool has_pending, bool current_tile_pending, bool can_undo, bool can_redo)
Definition
tile16_editor_action_state.h:17
yaze::editor::ComputeTile16ActionRowCount
int ComputeTile16ActionRowCount(int action_count, int column_count)
Definition
tile16_editor_action_state.h:44
yaze
Definition
patch_export_usage.cc:8
yaze::editor::Tile16ActionControlState
Definition
tile16_editor_action_state.h:9
yaze::editor::Tile16ActionControlState::can_redo
bool can_redo
Definition
tile16_editor_action_state.h:14
yaze::editor::Tile16ActionControlState::can_discard_current
bool can_discard_current
Definition
tile16_editor_action_state.h:12
yaze::editor::Tile16ActionControlState::can_undo
bool can_undo
Definition
tile16_editor_action_state.h:13
yaze::editor::Tile16ActionControlState::can_discard_all
bool can_discard_all
Definition
tile16_editor_action_state.h:11
yaze::editor::Tile16ActionControlState::can_write_pending
bool can_write_pending
Definition
tile16_editor_action_state.h:10
src
app
editor
overworld
tile16_editor_action_state.h
Generated by
1.10.0