Skip to content

Commit

Permalink
Upgraded to latest godot-core version
Browse files Browse the repository at this point in the history
  • Loading branch information
QueenOfSquiggles committed Mar 19, 2024
1 parent fad4f2d commit 61ed07c
Show file tree
Hide file tree
Showing 26 changed files with 60 additions and 77 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib"] # Compile this crate to a dynamic C library.
crate-type = ["cdylib"] # Compile this crate to a dynamic C library.

[dependencies]
# godot = { git = "https://github.com/godot-rust/gdext", branch="master" }
godot = { git = "https://github.com/godot-rust/gdext", rev="8d93420" }
godot = { git = "https://github.com/godot-rust/gdext", rev = "fe5b02b" }
2 changes: 1 addition & 1 deletion squiggles_core.gdextension
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[configuration]
entry_symbol = "gdext_rust_init"
compatibility_minimum = 4.2
compatibility_minimum = 4.3
reloadable = true


Expand Down
1 change: 0 additions & 1 deletion src/editor/editor_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use crate::scene::serialization::SquigglesSerialized;
#[class(tool, editor_plugin, init, base=EditorPlugin)]
struct SquigglesCoreEditorUtils {
tool_items: Option<Gd<PopupMenu>>,
#[base]
base: Base<EditorPlugin>,
}

Expand Down
2 changes: 0 additions & 2 deletions src/scene/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ pub const CAMERA_BRAIN_GROUP: &str = "camera_brain";
pub struct CameraBrain3D {
cam_buffer: Vec<Gd<VirtualCamera3D>>,
last_cam: bool,
#[base]
base: Base<Camera3D>,
}

Expand Down Expand Up @@ -82,7 +81,6 @@ pub struct VirtualCamera3D {
#[export]
push_on_ready: bool,

#[base]
base: Base<Marker3D>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/scene/dialog/core_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct CoreDialog {
pub event_bus: Option<Gd<DialogEvents>>,
pub gui: Option<Gd<DialogGUI>>,
pub blackboard: Blackboard,
#[base]

base: Base<Object>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/scene/dialog/dialog_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use godot::prelude::*;
#[class(init, base=Object)]
pub struct DialogBuilder {
nodes: Array<Dictionary>,
#[base]

node: Base<Object>,
}
#[godot_api]
Expand Down
1 change: 0 additions & 1 deletion src/scene/dialog/dialog_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use godot::prelude::*;
#[derive(GodotClass)]
#[class(init, base=Node)]
pub struct DialogEvents {
#[base]
node: Base<Node>,
}

Expand Down
16 changes: 8 additions & 8 deletions src/scene/dialog/dialog_gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct DialogGUI {
options_root: Option<Gd<Control>>,
current_index: usize,
state: DialogState,
#[base]

base: Base<CanvasLayer>,
}

Expand Down Expand Up @@ -143,7 +143,7 @@ impl DialogGUI {
}
rich_text.set_use_bbcode(true);
rich_text.set_text("[wave] Hello World! [/wave]".to_godot());
rich_text.set_v_size_flags(SizeFlags::SIZE_EXPAND_FILL);
rich_text.set_v_size_flags(SizeFlags::EXPAND_FILL);

let font_size = settings.bind().dialog_font_size as i32;
rich_text.add_theme_font_size_override(StringName::from("normal_font_size"), font_size);
Expand All @@ -169,7 +169,7 @@ impl DialogGUI {
margin.add_theme_constant_override(StringName::from("margin_left"), margin_lr.0);
margin.add_theme_constant_override(StringName::from("margin_right"), margin_lr.1);
margin.add_theme_constant_override(StringName::from("margin_bottom"), BOTTOM_MARGIN);
margin.set_anchors_and_offsets_preset(LayoutPreset::PRESET_BOTTOM_WIDE);
margin.set_anchors_and_offsets_preset(LayoutPreset::BOTTOM_WIDE);
margin.force_update_transform();
/*
*/
Expand Down Expand Up @@ -252,7 +252,7 @@ impl DialogGUI {
},
),
)
.flags(ConnectFlags::CONNECT_DEFERRED.ord() as u32)
.flags(ConnectFlags::DEFERRED.ord() as u32)
.done();
if is_first {
button.grab_focus();
Expand All @@ -261,10 +261,10 @@ impl DialogGUI {
}
let align = self.get_settings().bind().choice_buttons_align.clone();
root.set_anchors_and_offsets_preset(match align {
DialogAlign::Left => LayoutPreset::PRESET_CENTER_LEFT,
DialogAlign::Right => LayoutPreset::PRESET_CENTER_RIGHT,
DialogAlign::Center => LayoutPreset::PRESET_CENTER,
DialogAlign::FullWide => LayoutPreset::PRESET_VCENTER_WIDE,
DialogAlign::Left => LayoutPreset::CENTER_LEFT,
DialogAlign::Right => LayoutPreset::CENTER_RIGHT,
DialogAlign::Center => LayoutPreset::CENTER,
DialogAlign::FullWide => LayoutPreset::VCENTER_WIDE,
});
}

Expand Down
18 changes: 6 additions & 12 deletions src/scene/dialog/dialog_settings.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use godot::{engine::LabelSettings, prelude::*};

#[repr(u32)]
#[derive(Var, Default, Export, Clone)]
#[derive(Var, Default, Export, Clone, GodotConvert)]
#[godot(via=i64)]
pub enum DialogAlign {
Left = 0,
Right = 1,
Expand All @@ -21,8 +21,8 @@ impl DialogAlign {
}
}

#[repr(i32)]
#[derive(Var, Default, Export, Clone)]
#[derive(Var, Default, Export, Clone, GodotConvert)]
#[godot(via = i32)]
pub enum EEaseType {
#[default]
In = 0,
Expand All @@ -31,8 +31,8 @@ pub enum EEaseType {
OutIn = 3,
}

#[repr(i32)]
#[derive(Var, Default, Export, Clone)]
#[derive(Var, Default, Export, Clone, GodotConvert)]
#[godot(via=i32)]
pub enum ETransType {
#[default]
Linear = 0,
Expand Down Expand Up @@ -77,20 +77,14 @@ pub struct DialogSettings {

#[export]
pub anim_hide_trans: ETransType,

#[export]
pub anim_hide_duration: f32,

#[export]
pub auto_focus_choice_buttons: bool,

#[export]
pub choice_buttons_align: DialogAlign,

#[export]
pub words_per_minute: f32,

#[base]
base: Base<Resource>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/scene/game_globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn get_setting_name(name: &str) -> GString {
pub struct CoreGlobals {
#[var]
config: Gd<SquigglesCoreConfig>,
#[base]

base: Base<Object>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/scene/game_settings/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub struct GameAudioSettings {
audio_db_limit: f32,
#[export]
audio_bus_volumes: PackedFloat32Array,
#[base]

base: Base<Resource>,
}

Expand Down
9 changes: 4 additions & 5 deletions src/scene/game_settings/controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use godot::{

use crate::scene::serialization::{SaveDataBuilder, SquigglesSerialized};

#[repr(i32)]
#[derive(Var, PartialEq, PartialOrd, Eq, Ord)]
#[derive(Var, PartialEq, PartialOrd, Eq, Ord, GodotConvert)]
#[godot(via=i32)]
enum MappingsStyle {
All = 0,
AllCustom = 1,
Expand All @@ -29,8 +29,8 @@ impl MappingsStyle {
}
}

#[repr(i32)]
#[derive(Var, PartialEq, PartialOrd, Eq, Ord)]
#[derive(Var, PartialEq, PartialOrd, Eq, Ord, GodotConvert)]
#[godot(via = i32)]
enum HandledInputEvents {
JoypadButton = 0,
JoypadMotion = 1,
Expand Down Expand Up @@ -82,7 +82,6 @@ pub struct GameControlsSettings {
// internal
base_mappings: MappingStorage,
mapping_overrides: MappingStorage,
#[base]
base: Base<Resource>,
}
#[godot_api]
Expand Down
8 changes: 4 additions & 4 deletions src/scene/game_settings/gameplay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct GameGameplaySettings {
options_number: Array<Gd<GameplayOptionNumber>>,
#[export]
options_string: Array<Gd<GameplayOptionString>>,
#[base]

base: Base<Resource>,
}

Expand Down Expand Up @@ -82,7 +82,7 @@ pub struct GameplayOptionBool {
option_key: GString,
#[export]
value: bool,
#[base]

node: Base<Resource>,
}

Expand All @@ -107,7 +107,7 @@ pub struct GameplayOptionNumber {
allow_greater: bool,
#[export]
allow_lesser: bool,
#[base]

node: Base<Resource>,
}

Expand All @@ -126,7 +126,7 @@ pub struct GameplayOptionString {
treat_as_enum: bool,
#[export]
enum_values: PackedStringArray,
#[base]

node: Base<Resource>,
}

Expand Down
18 changes: 9 additions & 9 deletions src/scene/game_settings/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct GameGraphicsSettings {
window_fullscreen_mode: i32,
#[export(enum=(Standard=0, FSR10=1, FSR22=2))]
scaling_algorithm: i32,
#[base]

base: Base<Resource>,
}

Expand All @@ -48,8 +48,8 @@ impl IResource for GameGraphicsSettings {
value_contrast: 1.0,
value_saturation: 1.0,
value_exposure: 1.0,
scaling_algorithm: Scaling3DMode::SCALING_3D_MODE_BILINEAR.ord(),
window_fullscreen_mode: WindowMode::WINDOW_MODE_MAXIMIZED.ord(),
scaling_algorithm: Scaling3DMode::BILINEAR.ord(),
window_fullscreen_mode: WindowMode::MAXIMIZED.ord(),
}
}
}
Expand All @@ -69,14 +69,14 @@ impl GameGraphicsSettings {

// == window mode
DisplayServer::singleton().window_set_mode(match self.window_fullscreen_mode {
0 => WindowMode::WINDOW_MODE_WINDOWED,
1 => WindowMode::WINDOW_MODE_MINIMIZED,
2 => WindowMode::WINDOW_MODE_MAXIMIZED,
3 => WindowMode::WINDOW_MODE_FULLSCREEN,
4 => WindowMode::WINDOW_MODE_EXCLUSIVE_FULLSCREEN,
0 => WindowMode::WINDOWED,
1 => WindowMode::MINIMIZED,
2 => WindowMode::MAXIMIZED,
3 => WindowMode::FULLSCREEN,
4 => WindowMode::EXCLUSIVE_FULLSCREEN,
_ => {
godot_warn!("CoreGlobals/config/graphics:window_fullscreen_mode = {}. This is outside of the allowed bounds. Don't frickin do that!?", self.window_fullscreen_mode);
WindowMode::WINDOW_MODE_WINDOWED},
WindowMode::WINDOWED},
}
);

Expand Down
1 change: 0 additions & 1 deletion src/scene/game_settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pub struct SquigglesCoreConfig {
pub user_mods: Option<Gd<UserModifications>>,

//
#[base]
base: Base<Resource>,
}
#[godot_api]
Expand Down
6 changes: 2 additions & 4 deletions src/scene/game_settings/user_mods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use godot::{
engine::{DirAccess, Engine, ProjectSettings},
prelude::*,
};
#[repr(i32)]
#[derive(Debug, Var, Export, Default, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Debug, Var, Export, Default, PartialEq, Eq, PartialOrd, Ord, GodotConvert)]
#[godot(via=i32)]
pub enum ModLoadingType {
#[default]
Disabled = 0,
Expand All @@ -22,8 +22,6 @@ pub struct UserModifications {
allow_mods_override_files: bool,
#[export]
loading_type: ModLoadingType,

#[base]
base: Base<Resource>,
}

Expand Down
8 changes: 4 additions & 4 deletions src/scene/godot_replacements/custom_world_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::scene::game_globals::CoreGlobals;
struct WorldEnvironmentSettingsCompliant {
#[export]
force_override: bool,
#[base]

base: Base<WorldEnvironment>,
}

Expand Down Expand Up @@ -61,9 +61,9 @@ impl WorldEnvironmentSettingsCompliant {
env.set_tonemap_exposure(gfx.get_value_exposure());
if let Some(mut viewport) = self.base().get_viewport() {
viewport.set_scaling_3d_mode(match gfx.get_scaling_algorithm() {
0 => Scaling3DMode::SCALING_3D_MODE_BILINEAR,
1 => Scaling3DMode::SCALING_3D_MODE_FSR,
2 => Scaling3DMode::SCALING_3D_MODE_FSR2,
0 => Scaling3DMode::BILINEAR,
1 => Scaling3DMode::FSR,
2 => Scaling3DMode::FSR2,
_ => unreachable!(),
})
}
Expand Down
3 changes: 1 addition & 2 deletions src/scene/input/input_axis_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub struct InputAxisAllocatorResource {
event_up: StringName,
#[export]
event_down: StringName,
#[base]

node: Base<Resource>,
}

Expand All @@ -94,7 +94,6 @@ pub struct InputAxisAllocator {

value: Vector2,

#[base]
node: Base<Node>,
}

Expand Down
Loading

0 comments on commit 61ed07c

Please sign in to comment.