Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
eliminate warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsxguo committed Jul 3, 2022
1 parent 899a271 commit 1242d41
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
15 changes: 8 additions & 7 deletions example/sudoku/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
// POSSIBILITY OF SUCH DAMAGE.

#![no_std]

#![allow(unused)]
#![allow(non_upper_case_globals)]

pub use key::*;
use rkgpu::*;
Expand Down Expand Up @@ -63,8 +64,8 @@ pub fn input_handler(input_event: InputEvent) {
unsafe {
let (width, height) = __GPU_DEIVCE.as_mut().unwrap().resolution();
//println!("{},{},{}", input_event.event_type, input_event.code, input_event.value);
let SELECT_OLD_X = SELECT_X;
let SELECT_OLD_Y = SELECT_Y;
let select_old_x = SELECT_X;
let select_old_y = SELECT_Y;
if input_event.event_type == EV_KEY && input_event.value == 1 {
match input_event.code {
KEY_UP => {
Expand Down Expand Up @@ -118,31 +119,31 @@ pub fn input_handler(input_event: InputEvent) {
KEY_W => {
if SELECT_Y >= 75 {
SELECT_Y -= 75;
draw_select(SELECT_OLD_X, SELECT_OLD_Y, LIGHT_CYAN);
draw_select(select_old_x, select_old_y, LIGHT_CYAN);
draw_select(SELECT_X, SELECT_Y, RED);
}
INPUT_NUMBER = 100;
}
KEY_S => {
if SELECT_Y < 600 {
SELECT_Y += 75;
draw_select(SELECT_OLD_X, SELECT_OLD_Y, LIGHT_CYAN);
draw_select(select_old_x, select_old_y, LIGHT_CYAN);
draw_select(SELECT_X, SELECT_Y, RED);
}
INPUT_NUMBER = 100;
}
KEY_A => {
if SELECT_X >= 75 {
SELECT_X -= 75;
draw_select(SELECT_OLD_X, SELECT_OLD_Y, LIGHT_CYAN);
draw_select(select_old_x, select_old_y, LIGHT_CYAN);
draw_select(SELECT_X, SELECT_Y, RED);
}
INPUT_NUMBER = 100;
}
KEY_D => {
if SELECT_X < 600 {
SELECT_X += 75;
draw_select(SELECT_OLD_X, SELECT_OLD_Y, LIGHT_CYAN);
draw_select(select_old_x, select_old_y, LIGHT_CYAN);
draw_select(SELECT_X, SELECT_Y, RED);
}
INPUT_NUMBER = 100;
Expand Down
4 changes: 3 additions & 1 deletion example/sudoku/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#![no_std]
#![no_main]
#![allow(unused)]
#![allow(non_upper_case_globals)]
extern crate rkboot;
extern crate alloc;

Expand Down Expand Up @@ -372,7 +374,7 @@ fn init(sudoku: &mut Sudoku) {
rkgpu::init();
printg("Hello, world!\nHello, OSH-2022!\nHello, Runikraft!\n", 700, 10, RED, 255, 4);
printg("Use W, A, S, and D to move selecting rectangle.\nUse up, left, down, and right to move cursor.\nUse H for hint, use O for solution.", 0, 700, BLACK, 255, 2);
update_cursor(900, 500, true);
update_cursor(900, 400, true);
draw_select(0, 0, RED);
draw_sudoku_lattices(PURPLE, BLACK);
screen_flush();
Expand Down
4 changes: 2 additions & 2 deletions lib/rkgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub mod output;
pub use color::*;
pub use output::*;

use core::cmp::{max, min};
use core::time::Duration;
//use core::cmp::{max, min};
//use core::time::Duration;
use rkplat::drivers::virtio::__GPU_DEIVCE;
use crate::DIRECTION::{Horizontal, Vertical};

Expand Down
3 changes: 2 additions & 1 deletion lib/rkgpu/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#![allow(unused)]
use rkplat::drivers::virtio::__GPU_DEIVCE;
use crate::*;

use core::cmp::{min,max};

pub enum DIRECTION {
Horizontal,
Expand Down
16 changes: 8 additions & 8 deletions test/gpu0/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ unsafe fn draw_sudoku_lattices() -> u8 {
} else { 0 }
}

unsafe fn show_sudoku_number(pos_x: u8, pos_y: u8, number: u8) -> u8 {
if pos_x <= 8 && pos_y <= 8 {
let start_x: u32 = 75 * pos_x as u32 + 20;
let start_y: u32 = 75 * pos_y as u32 + 8;
draw_font(start_x, start_y, BLACK, 255, (number + 48).into(), 4);
0
} else { 1 }
}
// unsafe fn show_sudoku_number(pos_x: u8, pos_y: u8, number: u8) -> u8 {
// if pos_x <= 8 && pos_y <= 8 {
// let start_x: u32 = 75 * pos_x as u32 + 20;
// let start_y: u32 = 75 * pos_y as u32 + 8;
// draw_font(start_x, start_y, BLACK, 255, (number + 48).into(), 4);
// 0
// } else { 1 }
// }

0 comments on commit 1242d41

Please sign in to comment.