Skip to content

Commit

Permalink
Add back more code
Browse files Browse the repository at this point in the history
  • Loading branch information
vE5li committed Apr 14, 2024
1 parent b78a90a commit a71c7de
Show file tree
Hide file tree
Showing 16 changed files with 335 additions and 287 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Rust
target/
*/target

# Korangar
korangar/client/
Expand Down
9 changes: 5 additions & 4 deletions korangar/src/graphics/renderers/deferred/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use std::sync::Arc;
#[cfg(feature = "debug")]
use cgmath::SquareMatrix;
use cgmath::{Matrix4, Vector2, Vector3};
use korangar_interface::settings::FontSizeTrait;
use korangar_procedural::profile;
use vulkano::device::{DeviceOwned, Queue};
use vulkano::format::Format;
Expand Down Expand Up @@ -50,7 +51,7 @@ use crate::graphics::{
SpriteRenderer as SpriteRendererTrait, *,
};
use crate::interface::layout::{ScreenClip, ScreenPosition, ScreenSize};
use crate::loaders::{GameFileLoader, TextureLoader};
use crate::loaders::{FontSize, GameFileLoader, TextureLoader};
use crate::network::EntityId;
#[cfg(feature = "debug")]
use crate::world::{BoundingBox, MarkerIdentifier};
Expand Down Expand Up @@ -387,7 +388,7 @@ impl DeferredRenderer {
text: &str,
mut position: ScreenPosition,
color: Color,
font_size: f32,
font_size: FontSize,
) {
let window_size = self.get_window_size();

Expand All @@ -398,13 +399,13 @@ impl DeferredRenderer {
self.font_map.clone(),
window_size,
position,
ScreenSize::uniform(font_size),
ScreenSize::uniform(font_size.get_value()),
color,
10,
index,
true,
);
position.left += font_size / 2.0;
position.left += font_size.get_value() / 2.0;
}
}

Expand Down
11 changes: 7 additions & 4 deletions korangar/src/input/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use korangar_interface::event::ClickAction;
use korangar_interface::ElementEvent;

use super::HotbarSlot;
use crate::interface::application::Adapter;
use crate::interface::application::{Adapter, InternalThemeKind};
use crate::interface::resource::Move;
use crate::interface::theme::ThemeKind;
use crate::loaders::ServiceId;
use crate::network::{AccountId, CharacterId, CharacterServerInformation, EntityId};
#[cfg(feature = "debug")]
Expand All @@ -31,11 +30,15 @@ pub enum UserEvent {
OpenGraphicsSettingsWindow,
OpenAudioSettingsWindow,
OpenFriendsWindow,
SetThemeFile {
theme_file: String,
theme_kind: InternalThemeKind,
},
SaveTheme {
theme_kind: Option<ThemeKind>,
theme_kind: InternalThemeKind,
},
ReloadTheme {
theme_kind: Option<ThemeKind>,
theme_kind: InternalThemeKind,
},
SelectCharacter(usize),
OpenCharacterCreationWindow(usize),
Expand Down
55 changes: 24 additions & 31 deletions korangar/src/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use crate::graphics::{PickerRenderTarget, PickerTarget};
use crate::interface::application::Adapter;
use crate::interface::cursor::{MouseCursor, MouseCursorState};
use crate::interface::layout::{ScreenPosition, ScreenSize};
use crate::interface::resource::PartialMove;
use crate::network::ClientTick;

const MOUSE_SCOLL_MULTIPLIER: f32 = 30.0;
Expand Down Expand Up @@ -226,21 +227,17 @@ impl InputSystem {
}

ClickAction::Move(drop_resource) => {
todo!();
//self.mouse_input_mode =
// MouseInputMode::MoveItem(item_source, item);
let input_mode = match drop_resource {
PartialMove::Item { source, item } => MouseInputMode::MoveItem(source, item),
PartialMove::Skill { source, skill } => MouseInputMode::MoveSkill(source, skill),
};
self.mouse_input_mode = input_mode;
// Needs to re-render because some elements will
// render differently
// based on the mouse input mode.
//interface.schedule_render();
interface.schedule_render();
}

// ClickAction::MoveSkill(skill_source, skill) => {
// self.mouse_input_mode = MouseInputMode::MoveSkill(skill_source, skill);
// // Needs to re-render because some elements will render differently
// // based on the mouse input mode.
// interface.schedule_render();
// }
ClickAction::OpenWindow(prototype_window) => {
interface.open_window(application, focus_state, prototype_window.as_ref())
}
Expand Down Expand Up @@ -270,27 +267,23 @@ impl InputSystem {
// based on the mouse input mode.
interface.schedule_render();

println!("Implement drop!");
// match mouse_input_mode {
// MouseInputMode::MoveItem(item_source, item) => {
// if let Some(hovered_element) = &hovered_element {
// if let Some(item_move) =
// hovered_element.borrow_mut().drop_item(item_source, item) {
// events.push(UserEvent::MoveItem(item_move));
// }
// }
// }
// MouseInputMode::MoveSkill(skill_source, skill) => {
// if let Some(hovered_element) = &hovered_element {
// if let Some(skill_move) =
// hovered_element.borrow_mut().drop_skill(skill_source, skill)
// {
// events.push(UserEvent::MoveSkill(skill_move));
// }
// }
// }
// _ => {}
// }
match mouse_input_mode {
MouseInputMode::MoveItem(source, item) => {
if let Some(hovered_element) = &hovered_element {
if let Some(resource_move) = hovered_element.borrow_mut().drop_resource(PartialMove::Item { source, item }) {
events.push(UserEvent::MoveResource(resource_move));
}
}
}
MouseInputMode::MoveSkill(source, skill) => {
if let Some(hovered_element) = &hovered_element {
if let Some(resource_move) = hovered_element.borrow_mut().drop_resource(PartialMove::Skill { source, skill }) {
events.push(UserEvent::MoveResource(resource_move));
}
}
}
_ => {}
}
}
}

Expand Down
Loading

0 comments on commit a71c7de

Please sign in to comment.