Skip to content

Commit b569cf1

Browse files
committed
Make SCALE_STEP public
1 parent 6bdc4fb commit b569cf1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/vm/draw.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ use widestring::U16String;
33

44
use super::Content;
55

6-
pub(super) const SCALE_STEP: f32 = 0.05;
7-
86
// note: this allows larger values than mindustry does
97
#[derive(Debug, Clone, PartialEq, Eq)]
108
pub enum DrawCommand {
@@ -78,6 +76,10 @@ pub enum DrawCommand {
7876
Reset,
7977
}
8078

79+
impl DrawCommand {
80+
pub const SCALE_STEP: f32 = 0.05;
81+
}
82+
8183
bitflags! {
8284
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
8385
pub struct TextAlignment: u8 {

src/vm/instructions.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use super::{
1414
BuildingData, Content, DrawCommand, LObject, LString, LValue, LVar, LogicVM, ProcessorState,
1515
TextAlignment, VMLoadError, VMLoadResult,
1616
buildings::borrow_data,
17-
draw::SCALE_STEP,
1817
processor::{MAX_DRAW_BUFFER, MAX_TEXT_BUFFER},
1918
variables::{Constants, F64_DEG_RAD, F64_RAD_DEG, RAD_DEG},
2019
};
@@ -612,8 +611,8 @@ impl SimpleInstructionTrait for Draw {
612611
y: p2.numi() as i16,
613612
},
614613
DrawOp::Scale => DrawCommand::Scale {
615-
x: (p1.numf() / SCALE_STEP) as i16,
616-
y: (p2.numf() / SCALE_STEP) as i16,
614+
x: (p1.numf() / DrawCommand::SCALE_STEP) as i16,
615+
y: (p2.numf() / DrawCommand::SCALE_STEP) as i16,
617616
},
618617
DrawOp::Rotate => DrawCommand::Rotate {
619618
degrees: p1.numi() as i16,

0 commit comments

Comments
 (0)