summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-02-07 13:37:10 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-02-07 13:37:10 +0100
commit582eeb48091e7a4e2e8f93c8131e74d1bb3d0c5d (patch)
tree30ca7fe7ef0ae85fa497e61b32bcb5937bd6ffc7 /lib
parent95a039c8d1f926365c8bf3c20b09ec6250e60d8a (diff)
fix compilation errors/warnings
Diffstat (limited to 'lib')
-rw-r--r--lib/nes/app/application.cc50
-rw-r--r--lib/nes/app/application.hh8
-rw-r--r--lib/nes/sys/ppu.cc16
-rw-r--r--lib/nes/sys/ppu.hh10
4 files changed, 42 insertions, 42 deletions
diff --git a/lib/nes/app/application.cc b/lib/nes/app/application.cc
index bb2f1e4..ca04999 100644
--- a/lib/nes/app/application.cc
+++ b/lib/nes/app/application.cc
@@ -16,19 +16,19 @@ namespace nes::app
buffer_back_[y * display::width + x] = value;
base.set(x, y, value);
}
-
+
auto application::display_proxy::switch_buffers() -> void
{
auto r = renderer{ base };
- if (screen)
+ if (visible_screen)
{
- screen->render(r);
+ visible_screen->render(r);
}
- if (popup)
+ if (visible_popup)
{
- popup->render(r);
+ visible_popup->render(r);
}
if (preferences_.get_fps_counter())
@@ -37,7 +37,7 @@ namespace nes::app
auto const attrs = text_attributes{}
.set_max_width(2)
.set_alignment(text_alignment::right);
- r.render_text_format(32, 29, color::fixed_white, attrs, "{}", fps_counter.get_fps());
+ r.render_text_format(32, 29, color::fixed_white, attrs, "{}", fps.get_fps());
}
swap(buffer_front_, buffer_back_);
@@ -54,25 +54,25 @@ namespace nes::app
, screen_error_{ keyboard }
, screen_confirm_quit_{ keyboard }
{
- display_.screen = &screen_title_;
+ display_.visible_screen = &screen_title_;
}
auto application::frame(u32 const elapsed_time_us) -> void
{
- display_.fps_counter.frame(elapsed_time_us);
+ display_.fps.frame(elapsed_time_us);
- if (display_.popup)
+ if (display_.visible_popup)
{
- auto const a = display_.popup->process_events();
+ auto const a = display_.visible_popup->process_events();
handle_action(a);
}
- else if (display_.screen)
+ else if (display_.visible_screen)
{
- auto const a = display_.screen->process_events();
+ auto const a = display_.visible_screen->process_events();
handle_action(a);
}
- if (display_.screen)
+ if (display_.visible_screen)
{
// Directly let the scene render itself without rendering any gameplay (the scene is responsible for
// clearing the buffer).
@@ -87,8 +87,8 @@ namespace nes::app
{
screen_freeze_.freeze(display_.get_front());
screen_confirm_quit_.set_confirm(false);
- display_.screen = &screen_freeze_;
- display_.popup = &screen_confirm_quit_;
+ display_.visible_screen = &screen_freeze_;
+ display_.visible_popup = &screen_confirm_quit_;
display_.switch_buffers();
return;
}
@@ -105,7 +105,7 @@ namespace nes::app
if (console_->get_status() != status::success)
{
screen_freeze_.freeze(display_.get_front());
- display_.screen = &screen_freeze_;
+ display_.visible_screen = &screen_freeze_;
show_error("Runtime error", console_->get_status(), action::go_to_browser());
console_.clear();
}
@@ -143,13 +143,13 @@ namespace nes::app
}
case action::type::close_popup:
{
- display_.popup = nullptr;
+ display_.visible_popup = nullptr;
break;
}
case action::type::cancel_quit:
{
- display_.popup = nullptr;
- display_.screen = nullptr;
+ display_.visible_popup = nullptr;
+ display_.visible_screen = nullptr;
break;
}
case action::type::launch_game:
@@ -170,8 +170,8 @@ namespace nes::app
break;
}
- display_.screen = nullptr;
- display_.popup = nullptr;
+ display_.visible_screen = nullptr;
+ display_.visible_popup = nullptr;
break;
}
case action::type::show_error:
@@ -187,13 +187,13 @@ namespace nes::app
screen_error_.set_message(message);
screen_error_.set_error(error);
screen_error_.set_action(action);
- display_.popup = &screen_error_;
+ display_.visible_popup = &screen_error_;
}
auto application::go_to_screen(screen* screen) -> void
{
console_.clear();
- display_.screen = screen;
- display_.popup = nullptr;
+ display_.visible_screen = screen;
+ display_.visible_popup = nullptr;
}
-} // namespace nes::app \ No newline at end of file
+} // namespace nes::app
diff --git a/lib/nes/app/application.hh b/lib/nes/app/application.hh
index d0973e8..960b022 100644
--- a/lib/nes/app/application.hh
+++ b/lib/nes/app/application.hh
@@ -36,10 +36,10 @@ namespace nes::app
span<rgb, display::width * display::height> buffer_back_ = buffers_[1];
public:
- fps_counter fps_counter;
+ fps_counter fps;
display& base;
- screen* popup{ nullptr };
- screen* screen{ nullptr };
+ screen* visible_popup{ nullptr };
+ screen* visible_screen{ nullptr };
explicit display_proxy(preferences& preferences, display& base)
: preferences_{ preferences }
@@ -84,4 +84,4 @@ namespace nes::app
auto show_error(string_view message, status error, action const& action = action::close_popup()) -> void;
auto go_to_screen(screen*) -> void;
};
-} // namespace nes::app \ No newline at end of file
+} // namespace nes::app
diff --git a/lib/nes/sys/ppu.cc b/lib/nes/sys/ppu.cc
index 5b9f5db..56e99a8 100644
--- a/lib/nes/sys/ppu.cc
+++ b/lib/nes/sys/ppu.cc
@@ -74,7 +74,7 @@ namespace nes::sys
case 1:
{
// Load the tile pattern for the background from the name table.
- fetch_cycle_.tile = tile{ read8(address{ 0x2000 } + internal_.v.get_tile_address()) };
+ fetch_cycle_.background_tile = tile{ read8(address{ 0x2000 } + internal_.v.get_tile_address()) };
break;
}
case 3:
@@ -88,15 +88,15 @@ namespace nes::sys
auto const shift =
((internal_.v.get_coarse_y() & 0b00010u) << 1) |
((internal_.v.get_coarse_x() & 0b00010u) << 0);
- fetch_cycle_.palette = static_cast<palette>((read8(addr) >> shift) & 0b11);
+ fetch_cycle_.background_palette = static_cast<palette>((read8(addr) >> shift) & 0b11);
break;
}
case 5:
{
// Load bitplane 0 for the background tile's pattern.
- fetch_cycle_.bitplane_0 = get_tile_bitplane(
+ fetch_cycle_.pattern_bitplane_0 = get_tile_bitplane(
control_.get_background_pattern_table(),
- fetch_cycle_.tile,
+ fetch_cycle_.background_tile,
internal_.v.get_fine_y(),
bitplane::_0);
break;
@@ -104,9 +104,9 @@ namespace nes::sys
case 7:
{
// Load bitplane 1 for the background tile's pattern.
- fetch_cycle_.bitplane_1 = get_tile_bitplane(
+ fetch_cycle_.pattern_bitplane_1 = get_tile_bitplane(
control_.get_background_pattern_table(),
- fetch_cycle_.tile,
+ fetch_cycle_.background_tile,
internal_.v.get_fine_y(),
bitplane::_1);
break;
@@ -116,7 +116,7 @@ namespace nes::sys
// Fetch cycle done -> build the tile row for the background.
current_background_ = next_background_;
next_background_ = get_tile_row(
- fetch_cycle_.palette, fetch_cycle_.bitplane_0, fetch_cycle_.bitplane_1);
+ fetch_cycle_.background_palette, fetch_cycle_.pattern_bitplane_0, fetch_cycle_.pattern_bitplane_1);
break;
}
default:
@@ -697,4 +697,4 @@ namespace nes::sys
default: return rgb::from_hex(0x000000);
}
}
-} // namespace nes::sys \ No newline at end of file
+} // namespace nes::sys
diff --git a/lib/nes/sys/ppu.hh b/lib/nes/sys/ppu.hh
index 898ddd3..d82056e 100644
--- a/lib/nes/sys/ppu.hh
+++ b/lib/nes/sys/ppu.hh
@@ -217,10 +217,10 @@ namespace nes::sys
tile_row next_background_{};
struct
{
- tile tile{ 0 };
- palette palette{ 0 };
- u8 bitplane_0{ 0 };
- u8 bitplane_1{ 0 };
+ tile background_tile{ 0 };
+ palette background_palette{ 0 };
+ u8 pattern_bitplane_0{ 0 };
+ u8 pattern_bitplane_1{ 0 };
} fetch_cycle_{}; // Data populated during the fetch cycle.
evaluated_sprite sprites_[8]{}; // Evaluated sprites.
u32 sprite_count_{ 0 }; // Number of evaluated sprites in sprites_.
@@ -284,4 +284,4 @@ namespace nes::sys
auto ref_color(color_index) -> color&;
auto resolve_color(color) const -> rgb;
};
-} // namespace nes::sys \ No newline at end of file
+} // namespace nes::sys