Skip to content

Commit

Permalink
rename ListDir -> ListDirection
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamby777 committed Feb 1, 2024
1 parent 71fc6c1 commit aaedc4f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pets-lib/src/battle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl INode2D for BattleEngine {

fn process(&mut self, _delta: f64) {
use crate::wrapped::*;
let action = process_input(&mut self.choices, ListDir::TopToBottom);
let action = process_input(&mut self.choices, ListDirection::TopToBottom);

use ListOperation::*;
match action {
Expand Down
2 changes: 1 addition & 1 deletion pets-lib/src/dialogue/dbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl DialogBox {

pub fn process_choice_input(&mut self) {
use crate::wrapped::*;
let action = process_input(&mut self.choices, ListDir::LeftToRight);
let action = process_input(&mut self.choices, ListDirection::LeftToRight);

use ListOperation::*;
match action {
Expand Down
2 changes: 1 addition & 1 deletion pets-lib/src/main_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct TitleScreen {
impl INode2D for TitleScreen {
fn process(&mut self, _delta: f64) {
use crate::wrapped::*;
let action = process_input(&mut self.choices, ListDir::TopToBottom);
let action = process_input(&mut self.choices, ListDirection::TopToBottom);

use ListOperation::*;
match action {
Expand Down
10 changes: 5 additions & 5 deletions pets-lib/src/wrapped.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ fn is_pressed(name: &str) -> bool {
}

/// direction of a list's elements
pub enum ListDir {
pub enum ListDirection {
TopToBottom,
LeftToRight,
}

impl ListDir {
impl ListDirection {
pub fn ui_next(&self) -> &str {
use ListDir::*;
use ListDirection::*;
match self {
TopToBottom => "ui_down",
LeftToRight => "ui_right",
}
}

pub fn ui_prev(&self) -> &str {
use ListDir::*;
use ListDirection::*;
match self {
TopToBottom => "ui_up",
LeftToRight => "ui_left",
Expand All @@ -45,7 +45,7 @@ pub enum ListOperation<'a, T> {
}

/// Convert user input into list navigation
pub fn process_input<T: Clone>(wrap: &mut Wrapped<T>, dir: ListDir) -> ListOperation<T> {
pub fn process_input<T: Clone>(wrap: &mut Wrapped<T>, dir: ListDirection) -> ListOperation<T> {
use ListOperation::*;

let is_reverse = match wrap.selected {
Expand Down

0 comments on commit aaedc4f

Please sign in to comment.