Skip to content

Commit

Permalink
fix editor text
Browse files Browse the repository at this point in the history
  • Loading branch information
Nertsal committed Jun 1, 2024
1 parent 74e484c commit 2672009
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/editor/ui/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ impl StatefulWidget for EditorEditWidget {
fn update(&mut self, position: Aabb2<f32>, context: &mut UiContext, state: &mut Self::State) {
let editor = state;
let Some(level_editor) = &mut editor.level_edit else {
let size = vec2(10.0, 1.0) * context.font_size;
let size = vec2(15.0, 1.0) * context.font_size;
let warn = position
.align_aabb(size, vec2(0.5, 1.0))
.translate(vec2(0.0, size.y * 2.0));
.translate(vec2(0.0, -3.0 * size.y));
self.warn_select_level.show();
self.warn_select_level.update(warn, context);

Expand Down
4 changes: 1 addition & 3 deletions src/render/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ impl EditorRender {
self.geng.ugli(),
);

if ui.edit.state.visible {
self.draw_game(editor);
}
self.draw_game(editor, ui.edit.state.visible);
if !editor.render_options.hide_ui {
self.draw_ui(editor, ui);
}
Expand Down
21 changes: 13 additions & 8 deletions src/render/editor/game.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
use super::*;

impl EditorRender {
pub(super) fn draw_game(&mut self, editor: &Editor) {
let Some(level_editor) = &editor.level_edit else {
return;
};

pub(super) fn draw_game(&mut self, editor: &Editor, visible: bool) {
let options = &editor.render_options;
let mut theme = editor.options.theme;

let game_buffer =
&mut geng_utils::texture::attach_texture(&mut self.game_texture, self.geng.ugli());

let mut theme = level_editor.model.options.theme;
if level_editor.level_state.relevant().swap_palette {
std::mem::swap(&mut theme.light, &mut theme.dark);
if let Some(level_editor) = &editor.level_edit {
if level_editor.level_state.relevant().swap_palette {
std::mem::swap(&mut theme.light, &mut theme.dark);
}
}

ugli::clear(game_buffer, Some(theme.dark), None, None);
let screen_aabb = Aabb2::ZERO.extend_positive(game_buffer.size().as_f32());

let Some(level_editor) = &editor.level_edit else {
return;
};
if !visible {
return;
}

macro_rules! draw_game {
($alpha:expr) => {{
self.dither
Expand Down

0 comments on commit 2672009

Please sign in to comment.