Compare commits

..

2 commits

Author SHA1 Message Date
55c86b22ef Refactor and clean up code 2024-08-11 10:10:10 +03:00
fdebd1c9c5 Clean up comments 2024-08-11 10:04:21 +03:00
6 changed files with 6 additions and 33 deletions

View file

@ -1,17 +0,0 @@
#[derive(GodotClass)]
#[class(tool, init, editor_plugin, base=EditorPlugin)]
struct MiniEditorPlugin {
base: Base<EditorPlugin>,
}
#[godot_api]
impl IEditorPlugin for MiniEditorPlugin {
fn enter_tree(&mut self) {
}
fn exit_tree(&mut self) {
}
}

View file

@ -85,7 +85,7 @@ impl INode for Config {
self.resolution_scale = config.get_value(GString::from("graphics"), GString::from("resolution_scale")).to::<f32>(); self.resolution_scale = config.get_value(GString::from("graphics"), GString::from("resolution_scale")).to::<f32>();
} }
if !editor_hint { if !editor_hint {
// THIS CHECK IS VERY IMPORTANT!!! I don't want to fuck my godot up again by resizing the editor and moving it out of bounds.. // THIS CHECK IS VERY IMPORTANT!!! I don't want to screw my godot up again by resizing the editor and moving it out of bounds..
Self::apply_video_settings(self); Self::apply_video_settings(self);
} }
} }

View file

@ -57,7 +57,6 @@ impl Manager {
let editor_hint = Engine::singleton().is_editor_hint(); let editor_hint = Engine::singleton().is_editor_hint();
if !editor_hint { if !editor_hint {
let bgm = self.bgm.clone(); let bgm = self.bgm.clone();
godot_print!(" Hello world fj");
let mut stream: Gd<AudioStreamOggVorbis> = load(bgm); let mut stream: Gd<AudioStreamOggVorbis> = load(bgm);
stream.set_loop(false); stream.set_loop(false);
let mut player = AudioStreamPlayer::new_alloc(); let mut player = AudioStreamPlayer::new_alloc();

3
src/classes/mod.rs Normal file
View file

@ -0,0 +1,3 @@
pub mod scrambling_text;
pub mod manager;
pub mod config;

View file

@ -20,7 +20,6 @@ struct ScramblingText {
time_since_scramble: f64, //[DOC] This is the variable used for measuring time since the letters have been scrambled time_since_scramble: f64, //[DOC] This is the variable used for measuring time since the letters have been scrambled
time_since_step: f64, //[DOC] This is the variable used for measuring time since the amount of static letters was changed time_since_step: f64, //[DOC] This is the variable used for measuring time since the amount of static letters was changed
step_iterator: i32, step_iterator: i32,
editor_hint: bool,
base: Base<Label> base: Base<Label>
} }
@ -45,14 +44,12 @@ impl ILabel for ScramblingText {
step_iterator: 0, //[DOC] This is the iterator used for changing which letters to scramble step_iterator: 0, //[DOC] This is the iterator used for changing which letters to scramble
time_since_scramble: 0.0, time_since_scramble: 0.0,
time_since_step: 0.0, time_since_step: 0.0,
editor_hint: editor_hint,
base base
} }
} }
fn set_property(&mut self, property: StringName, value: Variant) -> bool { fn set_property(&mut self, property: StringName, value: Variant) -> bool {
// godot_print!("{:?}, {:?}", property, value);
if property == StringName::from("scrambling") { if property == StringName::from("scrambling") {
let boolean_value = value.booleanize(); let boolean_value = value.booleanize();
let original_text = self.original_text.clone(); let original_text = self.original_text.clone();
@ -77,8 +74,6 @@ impl ILabel for ScramblingText {
return false return false
} }
// Self::set_text(self, GString::from(self.original_text.clone().unwrap()))
} }
fn enter_tree(&mut self) { fn enter_tree(&mut self) {
@ -86,22 +81,16 @@ impl ILabel for ScramblingText {
self.original_text = Some(text.to_string()); self.original_text = Some(text.to_string());
} }
//TODO: THIS IS RETARDED:::::: PLEASE FIX BRUHHH
fn process(&mut self, delta: f64) { fn process(&mut self, delta: f64) {
if self.scrambling { if self.scrambling {
let original_text = self.original_text.clone().unwrap(); let original_text = self.original_text.clone().unwrap();
let duration = self.duration; let duration = self.duration;
let speed = self.speed; let speed = self.speed;
// godot_print!("{}", Engine::singleton().is_editor_hint());
self.time_since_scramble += delta; self.time_since_scramble += delta;
self.time_since_step += delta; self.time_since_step += delta;
if !self.infinite && self.time_since_step >= duration { if !self.infinite && self.time_since_step >= duration {
godot_print!("{}", original_text);
self.time_since_step = 0.0; self.time_since_step = 0.0;
self.step_iterator += 1; self.step_iterator += 1;
} }

View file

@ -1,9 +1,8 @@
use godot::{init::EditorRunBehavior, prelude::*}; use godot::{init::EditorRunBehavior, prelude::*};
struct MDT; struct MDT;
mod scrambling_text;
mod config; mod classes;
mod manager;
#[gdextension] #[gdextension]
unsafe impl ExtensionLibrary for MDT { unsafe impl ExtensionLibrary for MDT {