Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkMcCaskey committed Mar 22, 2018
1 parent 4106c91 commit 4394a97
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/io/applicationsettings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl ApplicationSettings {
.or_else(|_| Err("Could not build Config".to_string()))?;

// Set up debugging or command-line logging
let (should_debugger, handle) = if debug_mode && cfg!(feature = "debugger") {
let (should_debugger, _handle) = if debug_mode && cfg!(feature = "debugger") {
info!("Running in debug mode");
(true, None)
} else {
Expand Down
21 changes: 9 additions & 12 deletions src/io/applicationstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ use std;
use debugger::graphics::*;
use cpu;
use io::constants::*;
use io::input::*;

use io::sound::*;
use io::applicationsettings::ApplicationSettings;
use io::graphics::renderer::Renderer;
use io::graphics;
Expand All @@ -31,11 +29,10 @@ pub struct ApplicationState {
/// counts cycles since last divider register update
div_timer_cycles: u64,
/// counts cycles since last sound update
sound_cycles: u64,
_sound_cycles: u64,
debugger: Option<Debugger>,
initial_gameboy_state: cpu::Cpu,
// logger_handle: Option<log4rs::Handle>, // storing to keep alive
screenshot_frame_num: Wrapping<u64>,
_initial_gameboy_state: cpu::Cpu,
_screenshot_frame_num: Wrapping<u64>,
//ui_offset: Point, // TODO whole interface pan
application_settings: ApplicationSettings,
renderer: Box<Renderer>,
Expand Down Expand Up @@ -78,22 +75,22 @@ impl ApplicationState {
//let memvis_texture = tc.create_texture_static(txt_format, w, h).unwrap();

Ok(ApplicationState {
gameboy: gameboy,
gameboy,
//sound_system: device,
cycle_count: 0,
prev_time: 0,
// FIXME sound_cycles is probably wrong or not needed
sound_cycles: 0,
debugger: debugger,
_sound_cycles: 0,
debugger,
prev_hsync_cycles: 0,
timer_cycles: 0,
div_timer_cycles: 0,
initial_gameboy_state: gbcopy,
_initial_gameboy_state: gbcopy,
//logger_handle: handle,
screenshot_frame_num: Wrapping(0),
_screenshot_frame_num: Wrapping(0),
//ui_offset: Point::new(0, 0),
application_settings: app_settings,
renderer: renderer,
renderer,
//texture_creator: tc,
})
}
Expand Down
17 changes: 3 additions & 14 deletions src/io/graphics/sdl2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ pub mod input;
use sdl2;
use sdl2::*;
use sdl2::rect::{Point, Rect};
use sdl2::video::GLProfile;
use sdl2::audio::AudioDevice;
use sdl2::keyboard::Keycode;
use sdl2::surface::Surface;
use sdl2::pixels::PixelFormatEnum;
Expand All @@ -25,8 +23,6 @@ use io::sound::*;
use io::applicationsettings::ApplicationSettings;
use super::renderer::EventResponse;

use std;

use self::utility::*;

pub struct Sdl2Renderer {
Expand All @@ -39,19 +35,13 @@ pub struct Sdl2Renderer {
impl Sdl2Renderer {
pub fn new(app_settings: &ApplicationSettings) -> Result<Self, String> {
let sdl_context = sdl2::init()?;
let device = setup_audio(&sdl_context)?;
setup_audio(&sdl_context)?;
let controller = setup_controller_subsystem(&sdl_context);

// Set up graphics and window
trace!("Opening window");
let video_subsystem = sdl_context.video()?;

let gl_attr = video_subsystem.gl_attr();

gl_attr.set_context_profile(GLProfile::Core);
///gl_attr.set_context_flags().debug().set();
gl_attr.set_context_version(3, 2);

let window = {
let (window_width, window_height) = if app_settings.memvis_mode {
(RB_SCREEN_WIDTH, RB_SCREEN_HEIGHT)
Expand All @@ -69,7 +59,6 @@ impl Sdl2Renderer {
window_height,
)
.position_centered()
.opengl()
.build()
{
Ok(v) => v,
Expand Down Expand Up @@ -277,7 +266,7 @@ impl Renderer for Sdl2Renderer {
self.canvas.present();
}

fn draw_memory_visualization(&mut self, gameboy: &Cpu, app_settings: &ApplicationSettings) {
fn draw_memory_visualization(&mut self, _gameboy: &Cpu, _app_settings: &ApplicationSettings) {
unimplemented!();
}

Expand Down Expand Up @@ -455,7 +444,7 @@ impl Renderer for Sdl2Renderer {
}
}
}
Event::MouseWheel { y, .. } => {
Event::MouseWheel { y: _y, .. } => {
//self.ui_scale += y as f32;
// self.widgets[0].scale += y as f32;
}
Expand Down
7 changes: 2 additions & 5 deletions src/io/graphics/sdl2/vidram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ pub fn draw_tile_transparent<T>(
gameboy: &Cpu,
mem_offset: u16,
tile_idx: u16, // technically when used by GB it's only 8bit
screen_offset_x: i32,
screen_offset_y: i32,
_screen_offset_x: i32,
_screen_offset_y: i32,
flip_x: bool,
flip_y: bool,
texture: &mut Texture,
Expand Down Expand Up @@ -178,9 +178,6 @@ pub fn draw_tile_transparent<T>(
// let px_val = px_color*d;
// renderer.set_draw_color(Color::RGB(px_val, px_val, px_val));

// TODO add toggle for this or remove it
const DEBUG_OAM_BG: bool = false;

let realpx = if flip_x { TILE_SIZE_PX - px } else { px } as u8;
let realpy = if flip_y { TILE_SIZE_PX - py } else { py } as u8;

Expand Down
1 change: 0 additions & 1 deletion src/io/input.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pub mod sound;
pub mod constants;
pub mod input;
pub mod graphics;
pub mod arguments;
pub mod events;
Expand Down

0 comments on commit 4394a97

Please sign in to comment.