From b20bbe3fc91c6158e1ffb50140a62ba87e367daa Mon Sep 17 00:00:00 2001 From: Andrey Lesnikov Date: Fri, 27 Mar 2020 18:43:31 +0300 Subject: [PATCH] Undisguise gwg --- Cargo.toml | 2 +- ggwp-zgui/Cargo.toml | 4 ++-- ggwp-zgui/examples/absolute_coordinates.rs | 8 ++++---- ggwp-zgui/examples/layers_layout.rs | 10 +++++----- ggwp-zgui/examples/nested.rs | 10 +++++----- ggwp-zgui/examples/pixel_coordinates.rs | 8 ++++---- ggwp-zgui/examples/remove.rs | 10 +++++----- ggwp-zgui/examples/text_button.rs | 8 ++++---- ggwp-zgui/examples/vertical_layout.rs | 10 +++++----- ggwp-zgui/src/lib.rs | 12 ++++++------ ggwp-zscene/Cargo.toml | 6 +++--- ggwp-zscene/examples/action.rs | 10 +++++----- ggwp-zscene/src/action/change_color_to.rs | 2 +- ggwp-zscene/src/action/move_by.rs | 2 +- ggwp-zscene/src/action/set_color.rs | 2 +- ggwp-zscene/src/error.rs | 12 ++++++------ ggwp-zscene/src/lib.rs | 2 +- ggwp-zscene/src/sprite.rs | 2 +- src/error.rs | 6 +++--- src/main.rs | 12 ++++++------ src/screen.rs | 4 ++-- src/screen/ability_info.rs | 2 +- src/screen/agent_info.rs | 2 +- src/screen/battle.rs | 2 +- src/screen/battle/view.rs | 2 +- src/screen/battle/visualize.rs | 2 +- src/screen/campaign.rs | 2 +- src/screen/confirm.rs | 2 +- src/screen/main_menu.rs | 2 +- src/utils.rs | 4 ++-- 30 files changed, 81 insertions(+), 81 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index deb89c3b..23343f2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ zcomponents = { path = "zcomponents" } rand = { version = "0.7", features = [] } nalgebra = { version = "0.18", features = ["mint"] } # TODO: update (or replace with cgmath) qrand = { git = "https://github.com/not-fl3/quad-rand", package = "quad-rand", features = ['rand'] } -ggez = { git = "https://github.com/not-fl3/good-web-game", package = "good-web-game" } +gwg = { git = "https://github.com/not-fl3/good-web-game", package = "good-web-game" } [dev-dependencies] pretty_assertions = "0.6" diff --git a/ggwp-zgui/Cargo.toml b/ggwp-zgui/Cargo.toml index f7823cee..01a4ce32 100644 --- a/ggwp-zgui/Cargo.toml +++ b/ggwp-zgui/Cargo.toml @@ -5,9 +5,9 @@ authors = ["Andrey Lesnikov "] edition = "2018" license = "MIT/Apache-2.0" description = "Tiny and opionated GUI library" -keywords = ["ggez", "gamedev", "gui"] +keywords = ["gamedev", "gui"] [dependencies] log = "0.4" nalgebra = { version = "0.18", features = ["mint"] } -ggez = { git = "https://github.com/not-fl3/good-web-game", package = "good-web-game" } +gwg = { git = "https://github.com/not-fl3/good-web-game", package = "good-web-game" } diff --git a/ggwp-zgui/examples/absolute_coordinates.rs b/ggwp-zgui/examples/absolute_coordinates.rs index 9b02dc40..d2add460 100644 --- a/ggwp-zgui/examples/absolute_coordinates.rs +++ b/ggwp-zgui/examples/absolute_coordinates.rs @@ -1,9 +1,9 @@ -use ggez::{ +use ggwp_zgui as ui; +use gwg::{ conf, event, graphics::{self, Font, Rect, Text}, Context, GameResult, }; -use ggwp_zgui as ui; use nalgebra::Point2; #[derive(Clone, Copy, Debug)] @@ -94,8 +94,8 @@ impl event::EventHandler for State { } } -fn main() -> ggez::GameResult { - ggez::start( +fn main() -> gwg::GameResult { + gwg::start( conf::Conf { physical_root_dir: Some("resources".into()), ..Default::default() diff --git a/ggwp-zgui/examples/layers_layout.rs b/ggwp-zgui/examples/layers_layout.rs index 46f032a5..e55ca95a 100644 --- a/ggwp-zgui/examples/layers_layout.rs +++ b/ggwp-zgui/examples/layers_layout.rs @@ -1,9 +1,9 @@ -use ggez::{ +use ggwp_zgui as ui; +use gwg::{ conf, event, graphics::{self, Font, Image, Text}, Context, GameResult, }; -use ggwp_zgui as ui; use nalgebra::Point2; #[derive(Clone, Copy, Debug)] @@ -58,7 +58,7 @@ impl event::EventHandler for State { fn mouse_button_up_event( &mut self, context: &mut Context, - _: ggez::event::MouseButton, + _: gwg::event::MouseButton, x: f32, y: f32, ) { @@ -73,8 +73,8 @@ impl event::EventHandler for State { } } -fn main() -> ggez::GameResult { - ggez::start( +fn main() -> gwg::GameResult { + gwg::start( conf::Conf { physical_root_dir: Some("resources".into()), ..Default::default() diff --git a/ggwp-zgui/examples/nested.rs b/ggwp-zgui/examples/nested.rs index d0750a66..d5cb0074 100644 --- a/ggwp-zgui/examples/nested.rs +++ b/ggwp-zgui/examples/nested.rs @@ -1,9 +1,9 @@ -use ggez::{ +use ggwp_zgui as ui; +use gwg::{ conf, event, graphics::{self, Font, Image, Rect, Text}, Context, GameResult, }; -use ggwp_zgui as ui; use nalgebra::Point2; #[derive(Clone, Copy, Debug)] @@ -120,7 +120,7 @@ impl event::EventHandler for State { fn mouse_button_up_event( &mut self, context: &mut Context, - _: ggez::event::MouseButton, + _: gwg::event::MouseButton, x: f32, y: f32, ) { @@ -131,8 +131,8 @@ impl event::EventHandler for State { } } -fn main() -> ggez::GameResult { - ggez::start( +fn main() -> gwg::GameResult { + gwg::start( conf::Conf { physical_root_dir: Some("resources".into()), ..Default::default() diff --git a/ggwp-zgui/examples/pixel_coordinates.rs b/ggwp-zgui/examples/pixel_coordinates.rs index a9d21b4a..4e758002 100644 --- a/ggwp-zgui/examples/pixel_coordinates.rs +++ b/ggwp-zgui/examples/pixel_coordinates.rs @@ -1,9 +1,9 @@ -use ggez::{ +use ggwp_zgui as ui; +use gwg::{ conf, event, graphics::{self, Font, Text}, Context, GameResult, }; -use ggwp_zgui as ui; use nalgebra::Point2; #[derive(Clone, Copy, Debug)] @@ -94,8 +94,8 @@ impl event::EventHandler for State { } } -fn main() -> ggez::GameResult { - ggez::start( +fn main() -> gwg::GameResult { + gwg::start( conf::Conf { physical_root_dir: Some("resources".into()), ..Default::default() diff --git a/ggwp-zgui/examples/remove.rs b/ggwp-zgui/examples/remove.rs index d7e05f0a..3815c720 100644 --- a/ggwp-zgui/examples/remove.rs +++ b/ggwp-zgui/examples/remove.rs @@ -1,9 +1,9 @@ -use ggez::{ +use ggwp_zgui as ui; +use gwg::{ conf, event, graphics::{self, Font, Image, Text}, Context, GameResult, }; -use ggwp_zgui as ui; use nalgebra::Point2; #[derive(Clone, Copy, Debug)] @@ -82,7 +82,7 @@ impl event::EventHandler for State { fn mouse_button_up_event( &mut self, context: &mut Context, - _: ggez::event::MouseButton, + _: gwg::event::MouseButton, x: f32, y: f32, ) { @@ -100,8 +100,8 @@ impl event::EventHandler for State { } } -fn main() -> ggez::GameResult { - ggez::start( +fn main() -> gwg::GameResult { + gwg::start( conf::Conf { physical_root_dir: Some("resources".into()), ..Default::default() diff --git a/ggwp-zgui/examples/text_button.rs b/ggwp-zgui/examples/text_button.rs index 0b11747f..b80e5b90 100644 --- a/ggwp-zgui/examples/text_button.rs +++ b/ggwp-zgui/examples/text_button.rs @@ -1,9 +1,9 @@ -use ggez::{ +use ggwp_zgui as ui; +use gwg::{ conf, event, graphics::{self, Font, Text}, Context, GameResult, }; -use ggwp_zgui as ui; use nalgebra::Point2; #[derive(Clone, Copy, Debug)] @@ -68,8 +68,8 @@ impl event::EventHandler for State { } } -fn main() -> ggez::GameResult { - ggez::start( +fn main() -> gwg::GameResult { + gwg::start( conf::Conf { physical_root_dir: Some("resources".into()), ..Default::default() diff --git a/ggwp-zgui/examples/vertical_layout.rs b/ggwp-zgui/examples/vertical_layout.rs index 6f9ed5a1..009e58bf 100644 --- a/ggwp-zgui/examples/vertical_layout.rs +++ b/ggwp-zgui/examples/vertical_layout.rs @@ -1,9 +1,9 @@ -use ggez::{ +use ggwp_zgui as ui; +use gwg::{ conf, event, graphics::{self, Font, Text}, Context, GameResult, }; -use ggwp_zgui as ui; use nalgebra::Point2; #[derive(Clone, Copy, Debug)] @@ -63,7 +63,7 @@ impl event::EventHandler for State { fn mouse_button_up_event( &mut self, context: &mut Context, - _: ggez::event::MouseButton, + _: gwg::event::MouseButton, x: f32, y: f32, ) { @@ -74,8 +74,8 @@ impl event::EventHandler for State { } } -fn main() -> ggez::GameResult { - ggez::start( +fn main() -> gwg::GameResult { + gwg::start( conf::Conf { physical_root_dir: Some("resources".into()), ..Default::default() diff --git a/ggwp-zgui/src/lib.rs b/ggwp-zgui/src/lib.rs index a33ce4e1..18b23b94 100644 --- a/ggwp-zgui/src/lib.rs +++ b/ggwp-zgui/src/lib.rs @@ -7,7 +7,7 @@ use std::{ sync::mpsc::{channel, Receiver, Sender}, }; -use ggez::{ +use gwg::{ graphics::{self, Color, Drawable, Rect}, Context, GameResult, }; @@ -39,11 +39,11 @@ pub fn pack(widget: W) -> RcWidget { mod error { use std::{error::Error as StdError, fmt}; - use ggez::GameError; + use gwg::GameError; #[derive(Debug)] pub enum Error { - GgezError(GameError), + GwgError(GameError), BadBorderCoefficient, BadContentCoefficient, NoDimensions, @@ -52,7 +52,7 @@ mod error { impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - Error::GgezError(ref e) => write!(f, "GGEZ Error: {}", e), + Error::GwgError(ref e) => write!(f, "gwg Error: {}", e), Error::BadBorderCoefficient => write!(f, "Border size is too large"), Error::BadContentCoefficient => write!(f, "Content size is too large"), Error::NoDimensions => write!(f, "The drawable has no dimensions"), @@ -63,7 +63,7 @@ mod error { impl StdError for Error { fn source(&self) -> Option<&(dyn StdError + 'static)> { match *self { - Error::GgezError(ref e) => Some(e), + Error::GwgError(ref e) => Some(e), Error::BadBorderCoefficient | Error::BadContentCoefficient | Error::NoDimensions => None, @@ -73,7 +73,7 @@ mod error { impl From for Error { fn from(e: GameError) -> Self { - Error::GgezError(e) + Error::GwgError(e) } } } diff --git a/ggwp-zscene/Cargo.toml b/ggwp-zscene/Cargo.toml index 08d63f58..25bc79fa 100644 --- a/ggwp-zscene/Cargo.toml +++ b/ggwp-zscene/Cargo.toml @@ -4,9 +4,9 @@ version = "0.1.0" authors = ["Andrey Lesnikov "] edition = "2018" license = "MIT/Apache-2.0" -description = "Scene and Actions for GGEZ" -keywords = ["ggez", "gamedev", "2D"] +description = "Scene and Actions for gwg" +keywords = ["gamedev", "2D"] [dependencies] nalgebra = { version = "0.18", features = ["mint"] } -ggez = { git = "https://github.com/not-fl3/good-web-game", package = "good-web-game" } +gwg = { git = "https://github.com/not-fl3/good-web-game", package = "good-web-game" } diff --git a/ggwp-zscene/examples/action.rs b/ggwp-zscene/examples/action.rs index af3a030c..a16703cb 100644 --- a/ggwp-zscene/examples/action.rs +++ b/ggwp-zscene/examples/action.rs @@ -1,11 +1,11 @@ use std::time::Duration; -use ggez::{ +use ggwp_zscene::{self as zscene, action, Boxed, Layer, Scene, Sprite}; +use gwg::{ conf, event, graphics::{self, Font, Rect, Text}, Context, GameResult, }; -use ggwp_zscene::{self as zscene, action, Boxed, Layer, Scene, Sprite}; use nalgebra::{Point2, Vector2}; #[derive(Debug, Clone, Default)] @@ -94,7 +94,7 @@ impl State { impl event::EventHandler for State { fn update(&mut self, context: &mut Context) -> GameResult { - let dtime = ggez::timer::delta(context); + let dtime = gwg::timer::delta(context); self.scene.tick(dtime); Ok(()) } @@ -110,8 +110,8 @@ impl event::EventHandler for State { } } -fn main() -> ggez::GameResult { - ggez::start( +fn main() -> gwg::GameResult { + gwg::start( conf::Conf { physical_root_dir: Some("resources".into()), ..Default::default() diff --git a/ggwp-zscene/src/action/change_color_to.rs b/ggwp-zscene/src/action/change_color_to.rs index a305255b..429c8572 100644 --- a/ggwp-zscene/src/action/change_color_to.rs +++ b/ggwp-zscene/src/action/change_color_to.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use ggez::{graphics::Color, timer}; +use gwg::{graphics::Color, timer}; use crate::{Action, Sprite}; diff --git a/ggwp-zscene/src/action/move_by.rs b/ggwp-zscene/src/action/move_by.rs index 38ca9271..ea03d417 100644 --- a/ggwp-zscene/src/action/move_by.rs +++ b/ggwp-zscene/src/action/move_by.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use ggez::timer; +use gwg::timer; use nalgebra::Vector2; use crate::{Action, Sprite}; diff --git a/ggwp-zscene/src/action/set_color.rs b/ggwp-zscene/src/action/set_color.rs index adf93e62..87d87e38 100644 --- a/ggwp-zscene/src/action/set_color.rs +++ b/ggwp-zscene/src/action/set_color.rs @@ -1,4 +1,4 @@ -use ggez::graphics::Color; +use gwg::graphics::Color; use crate::{Action, Sprite}; diff --git a/ggwp-zscene/src/error.rs b/ggwp-zscene/src/error.rs index 6e0384ce..48893365 100644 --- a/ggwp-zscene/src/error.rs +++ b/ggwp-zscene/src/error.rs @@ -2,14 +2,14 @@ use std::{error, fmt}; #[derive(Debug)] pub enum Error { - GgezError(ggez::GameError), + GwgError(gwg::GameError), NoDimensions, } impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - Error::GgezError(ref e) => write!(f, "GGEZ Error: {}", e), + Error::GwgError(ref e) => write!(f, "gwg Error: {}", e), Error::NoDimensions => write!(f, "The drawable has no dimensions"), } } @@ -18,14 +18,14 @@ impl fmt::Display for Error { impl error::Error for Error { fn source(&self) -> Option<&(dyn error::Error + 'static)> { match self { - Error::GgezError(ref e) => Some(e), + Error::GwgError(ref e) => Some(e), Error::NoDimensions => None, } } } -impl From for Error { - fn from(e: ggez::GameError) -> Self { - Error::GgezError(e) +impl From for Error { + fn from(e: gwg::GameError) -> Self { + Error::GwgError(e) } } diff --git a/ggwp-zscene/src/lib.rs b/ggwp-zscene/src/lib.rs index 4bf4d875..d386d596 100644 --- a/ggwp-zscene/src/lib.rs +++ b/ggwp-zscene/src/lib.rs @@ -1,6 +1,6 @@ use std::{cell::RefCell, rc::Rc, time::Duration}; -use ggez::{Context, GameResult}; +use gwg::{Context, GameResult}; // TODO: z-order? (https://github.com/ozkriff/zemeroth/issues/319) diff --git a/ggwp-zscene/src/sprite.rs b/ggwp-zscene/src/sprite.rs index 4e4e3815..27a9b63d 100644 --- a/ggwp-zscene/src/sprite.rs +++ b/ggwp-zscene/src/sprite.rs @@ -1,6 +1,6 @@ use std::{cell::RefCell, collections::HashMap, fmt, hash::Hash, path::Path, rc::Rc}; -use ggez::{ +use gwg::{ graphics::{self, Drawable, Rect}, Context, GameResult, }; diff --git a/src/error.rs b/src/error.rs index 4ebe5797..922c9675 100644 --- a/src/error.rs +++ b/src/error.rs @@ -2,7 +2,7 @@ use std::{error, fmt, io, path::PathBuf}; #[derive(Debug, derive_more::From)] pub enum ZError { - GgezError(ggez::GameError), + GwgError(gwg::GameError), UiError(ui::Error), SceneError(scene::Error), RonDeserializeError { @@ -21,7 +21,7 @@ impl ZError { impl fmt::Display for ZError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - ZError::GgezError(ref e) => write!(f, "GGEZ Error: {}", e), + ZError::GwgError(ref e) => write!(f, "gwg Error: {}", e), ZError::UiError(ref e) => write!(f, "ZGUI Error: {}", e), ZError::SceneError(ref e) => write!(f, "ZScene Error: {}", e), ZError::RonDeserializeError { error, path } => { @@ -36,7 +36,7 @@ impl fmt::Display for ZError { impl error::Error for ZError { fn source(&self) -> Option<&(dyn error::Error + 'static)> { match self { - ZError::GgezError(ref e) => Some(e), + ZError::GwgError(ref e) => Some(e), ZError::UiError(ref e) => Some(e), ZError::SceneError(ref e) => Some(e), ZError::RonDeserializeError { error, .. } => Some(error), diff --git a/src/main.rs b/src/main.rs index 82049b97..abf496e6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ #![windows_subsystem = "windows"] -use ggez::{ +use gwg::{ conf::Conf, event, graphics::{self, Rect}, @@ -63,7 +63,7 @@ impl event::EventHandler for MainState { fn mouse_button_up_event( &mut self, context: &mut Context, - _: ggez::event::MouseButton, + _: gwg::event::MouseButton, x: f32, y: f32, ) { @@ -98,13 +98,13 @@ fn conf() -> Conf { #[cfg(target_arch = "wasm32")] fn conf() -> Conf { Conf { - cache: ggez::conf::Cache::Tar(include_bytes!("../assets.tar").to_vec()), - loading: ggez::conf::Loading::Embedded, + cache: gwg::conf::Cache::Tar(include_bytes!("../assets.tar").to_vec()), + loading: gwg::conf::Loading::Embedded, ..Default::default() } } -fn main() -> ggez::GameResult { +fn main() -> gwg::GameResult { #[cfg(not(target_arch = "wasm32"))] { // std::env isn't supported on WASM. @@ -113,7 +113,7 @@ fn main() -> ggez::GameResult { } } env_logger::init(); - ggez::start(conf(), |mut context| { + gwg::start(conf(), |mut context| { log::info!("Checking assets hash file..."); utils::check_assets_hash(context, ASSETS_HASHSUM).expect("Wrong assets check sum"); log::info!("Creating MainState..."); diff --git a/src/screen.rs b/src/screen.rs index e284a03d..35161002 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -1,7 +1,7 @@ use log::info; use std::{fmt::Debug, time::Duration}; -use ggez::{ +use gwg::{ self, graphics::{self, Color}, Context, @@ -92,7 +92,7 @@ impl Screens { } pub fn update(&mut self, context: &mut Context) -> ZResult { - let dtime = ggez::timer::delta(context); + let dtime = gwg::timer::delta(context); let command = self.screen_mut().top_mut().update(context, dtime)?; self.handle_command(context, command) } diff --git a/src/screen/ability_info.rs b/src/screen/ability_info.rs index f54a73c5..97f71249 100644 --- a/src/screen/ability_info.rs +++ b/src/screen/ability_info.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use ggez::{ +use gwg::{ graphics::{self, Text}, Context, }; diff --git a/src/screen/agent_info.rs b/src/screen/agent_info.rs index 25933091..2e3aeb5e 100644 --- a/src/screen/agent_info.rs +++ b/src/screen/agent_info.rs @@ -1,6 +1,6 @@ use std::{collections::HashMap, time::Duration}; -use ggez::{ +use gwg::{ graphics::{self, Text}, Context, }; diff --git a/src/screen/battle.rs b/src/screen/battle.rs index b7fcd15a..ddba6a98 100644 --- a/src/screen/battle.rs +++ b/src/screen/battle.rs @@ -3,7 +3,7 @@ use std::{ time::Duration, }; -use ggez::{ +use gwg::{ graphics::{self, Font, Text}, Context, }; diff --git a/src/screen/battle/view.rs b/src/screen/battle/view.rs index f4ae72d4..83471845 100644 --- a/src/screen/battle/view.rs +++ b/src/screen/battle/view.rs @@ -1,6 +1,6 @@ use std::{collections::HashMap, default::Default, time::Duration}; -use ggez::{ +use gwg::{ graphics::{Color, Font, Image, Text}, Context, }; diff --git a/src/screen/battle/visualize.rs b/src/screen/battle/visualize.rs index 693bb977..70ec7e24 100644 --- a/src/screen/battle/visualize.rs +++ b/src/screen/battle/visualize.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use ggez::{ +use gwg::{ graphics::{Color, Text}, Context, }; diff --git a/src/screen/campaign.rs b/src/screen/campaign.rs index cbbd2e15..083db033 100644 --- a/src/screen/campaign.rs +++ b/src/screen/campaign.rs @@ -3,7 +3,7 @@ use std::{ time::Duration, }; -use ggez::{ +use gwg::{ graphics::{self, Font, Text}, Context, }; diff --git a/src/screen/confirm.rs b/src/screen/confirm.rs index f9a92f97..f90775b0 100644 --- a/src/screen/confirm.rs +++ b/src/screen/confirm.rs @@ -3,7 +3,7 @@ use std::{ time::Duration, }; -use ggez::{ +use gwg::{ graphics::{self, Text}, Context, }; diff --git a/src/screen/main_menu.rs b/src/screen/main_menu.rs index 4d72fbf1..b24d4da5 100644 --- a/src/screen/main_menu.rs +++ b/src/screen/main_menu.rs @@ -3,7 +3,7 @@ use std::{ time::Duration, }; -use ggez::{ +use gwg::{ graphics::{Font, Text}, Context, }; diff --git a/src/utils.rs b/src/utils.rs index 4c6436c7..3f48a30f 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,6 +1,6 @@ use std::{io::Read, path::Path, process, sync::mpsc::Receiver, time::Duration}; -use ggez::{ +use gwg::{ graphics::{Font, Rect}, Context, }; @@ -29,7 +29,7 @@ pub fn check_assets_hash(context: &mut Context, expected: &str) -> ZResult { /// Read a file to a string. pub fn read_file>(context: &mut Context, path: P) -> ZResult { let mut buf = String::new(); - let mut file = ggez::filesystem::open(context, path)?; + let mut file = gwg::filesystem::open(context, path)?; file.read_to_string(&mut buf)?; Ok(buf) }