Update to use crate:: for current crate, for Rust 2018 edition
From `cargo fix --edition`, see https://rust-lang-nursery.github.io/edition-guide/print.html#the-crate-keyword-refers-to-the-current-crate
This commit is contained in:
parent
db02f9e790
commit
a40cd43a2e
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use console;
|
||||
use crate::console;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub const CL_USERNAME: console::CVar<String> = console::CVar {
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
use std::thread;
|
||||
use std::sync::mpsc;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use world;
|
||||
use world::block;
|
||||
use render;
|
||||
use resources;
|
||||
use model;
|
||||
use types::bit::Set;
|
||||
use shared::Direction;
|
||||
use crate::world;
|
||||
use crate::world::block;
|
||||
use crate::render;
|
||||
use crate::resources;
|
||||
use crate::model;
|
||||
use crate::types::bit::Set;
|
||||
use crate::shared::Direction;
|
||||
|
||||
const NUM_WORKERS: usize = 8;
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ use std::fs;
|
|||
use std::io::{BufWriter, Write, BufRead, BufReader};
|
||||
use log;
|
||||
|
||||
use ui;
|
||||
use render;
|
||||
use format::{Component, TextComponent, Color};
|
||||
use crate::ui;
|
||||
use crate::render;
|
||||
use crate::format::{Component, TextComponent, Color};
|
||||
|
||||
const FILTERED_CRATES: &'static [&'static str] = &[
|
||||
//"reqwest", // TODO: needed?
|
||||
|
|
|
@ -12,18 +12,18 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use types::bit::Set as BSet;
|
||||
use crate::types::bit::Set as BSet;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::hash::BuildHasherDefault;
|
||||
use types::hash::FNVHash;
|
||||
use crate::types::hash::FNVHash;
|
||||
use std::any::{Any, TypeId};
|
||||
use std::cell::RefCell;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
use world;
|
||||
use render;
|
||||
use crate::world;
|
||||
use crate::render;
|
||||
|
||||
/// Used to reference an entity.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
pub mod sign;
|
||||
|
||||
use world::block::Block;
|
||||
use shared::Position;
|
||||
use ecs;
|
||||
use crate::world::block::Block;
|
||||
use crate::shared::Position;
|
||||
use crate::ecs;
|
||||
|
||||
pub fn add_systems(m: &mut ecs::Manager) {
|
||||
sign::add_systems(m);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
use ecs;
|
||||
use format::{self, Component};
|
||||
use shared::{Direction, Position};
|
||||
use world;
|
||||
use world::block::Block;
|
||||
use render;
|
||||
use render::model::{self, FormatState};
|
||||
use crate::ecs;
|
||||
use crate::format::{self, Component};
|
||||
use crate::shared::{Direction, Position};
|
||||
use crate::world;
|
||||
use crate::world::block::Block;
|
||||
use crate::render;
|
||||
use crate::render::model::{self, FormatState};
|
||||
|
||||
pub fn add_systems(m: &mut ecs::Manager) {
|
||||
let sys = SignRenderer::new(m);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
pub mod player;
|
||||
pub mod block_entity;
|
||||
|
||||
use ecs;
|
||||
use crate::ecs;
|
||||
use cgmath::Vector3;
|
||||
use collision::Aabb3;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
use ecs;
|
||||
use crate::ecs;
|
||||
use super::{
|
||||
Position,
|
||||
TargetPosition,
|
||||
|
@ -11,18 +11,18 @@ use super::{
|
|||
GameInfo,
|
||||
Light
|
||||
};
|
||||
use world;
|
||||
use render;
|
||||
use render::model::{self, FormatState};
|
||||
use types::Gamemode;
|
||||
use crate::world;
|
||||
use crate::render;
|
||||
use crate::render::model::{self, FormatState};
|
||||
use crate::types::Gamemode;
|
||||
use collision::{Aabb, Aabb3};
|
||||
use cgmath::{self, Point3, Vector3, Matrix4, Decomposed, Rotation3, Rad, Quaternion};
|
||||
use std::collections::HashMap;
|
||||
use std::hash::BuildHasherDefault;
|
||||
use types::hash::FNVHash;
|
||||
use settings::Stevenkey;
|
||||
use shared::Position as BPosition;
|
||||
use format;
|
||||
use crate::types::hash::FNVHash;
|
||||
use crate::settings::Stevenkey;
|
||||
use crate::shared::Position as BPosition;
|
||||
use crate::format;
|
||||
|
||||
pub fn add_systems(m: &mut ecs::Manager) {
|
||||
let sys = MovementHandler::new(m);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
use super::*;
|
||||
use ecs;
|
||||
use world;
|
||||
use render;
|
||||
use shared::Position as BPos;
|
||||
use crate::ecs;
|
||||
use crate::world;
|
||||
use crate::render;
|
||||
use crate::shared::Position as BPos;
|
||||
use cgmath::InnerSpace;
|
||||
|
||||
pub struct ApplyVelocity {
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use nbt;
|
||||
use protocol::{self, Serializable};
|
||||
use crate::nbt;
|
||||
use crate::protocol::{self, Serializable};
|
||||
use std::io;
|
||||
use byteorder::{BigEndian, WriteBytesExt, ReadBytesExt};
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ use std::rc::Rc;
|
|||
use std::marker::PhantomData;
|
||||
use std::thread;
|
||||
use std::sync::mpsc;
|
||||
use protocol::mojang;
|
||||
use crate::protocol::mojang;
|
||||
use sdl2::Sdl;
|
||||
use sdl2::keyboard;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
use std::io::Write;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use world::{self, block};
|
||||
use shared::Direction;
|
||||
use model::BlockVertex;
|
||||
use render;
|
||||
use crate::world::{self, block};
|
||||
use crate::shared::Direction;
|
||||
use crate::model::BlockVertex;
|
||||
use crate::render;
|
||||
|
||||
pub fn render_liquid<W: Write>(textures: Arc<RwLock<render::TextureManager>>,lava: bool, snapshot: &world::Snapshot, x: i32, y: i32, z: i32, buf: &mut W) -> usize {
|
||||
let get_liquid = if lava {
|
||||
|
|
|
@ -6,15 +6,15 @@ use std::collections::HashMap;
|
|||
use std::cell::RefCell;
|
||||
use std::io::Write;
|
||||
use byteorder::{WriteBytesExt, NativeEndian};
|
||||
use resources;
|
||||
use render;
|
||||
use world;
|
||||
use world::block::{Block, TintType};
|
||||
use shared::Direction;
|
||||
use crate::resources;
|
||||
use crate::render;
|
||||
use crate::world;
|
||||
use crate::world::block::{Block, TintType};
|
||||
use crate::shared::Direction;
|
||||
use serde_json;
|
||||
|
||||
use std::hash::BuildHasherDefault;
|
||||
use types::hash::FNVHash;
|
||||
use crate::types::hash::FNVHash;
|
||||
|
||||
use rand::Rng;
|
||||
use image::GenericImageView;
|
||||
|
@ -943,7 +943,7 @@ fn calculate_biome(snapshot: &world::Snapshot, x: i32, z: i32, img: &image::Dyna
|
|||
fn calculate_light(snapshot: &world::Snapshot, orig_x: i32, orig_y: i32, orig_z: i32,
|
||||
x: f64, y: f64, z: f64, face: Direction, smooth: bool, force: bool) -> (u16, u16) {
|
||||
use std::cmp::max;
|
||||
use world::block;
|
||||
use crate::world::block;
|
||||
let (ox, oy, oz) = face.get_offset();
|
||||
|
||||
let s_block_light = snapshot.get_block_light(orig_x + ox, orig_y + oy, orig_z + oz);
|
||||
|
|
|
@ -22,8 +22,8 @@ use reqwest;
|
|||
|
||||
pub mod mojang;
|
||||
|
||||
use nbt;
|
||||
use format;
|
||||
use crate::nbt;
|
||||
use crate::format;
|
||||
use std::fmt;
|
||||
use std::default;
|
||||
use std::net::TcpStream;
|
||||
|
@ -34,7 +34,7 @@ use byteorder::{BigEndian, WriteBytesExt, ReadBytesExt};
|
|||
use flate2::read::{ZlibDecoder, ZlibEncoder};
|
||||
use flate2::Compression;
|
||||
use std::time::{Instant, Duration};
|
||||
use shared::Position;
|
||||
use crate::shared::Position;
|
||||
|
||||
pub const SUPPORTED_PROTOCOL: i32 = 315;
|
||||
|
||||
|
@ -52,7 +52,7 @@ macro_rules! state_packets {
|
|||
)*
|
||||
})+
|
||||
})+) => {
|
||||
use protocol::*;
|
||||
use crate::protocol::*;
|
||||
use std::io;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -72,13 +72,13 @@ macro_rules! state_packets {
|
|||
$(
|
||||
pub mod $dir {
|
||||
#![allow(unused_imports)]
|
||||
use protocol::*;
|
||||
use crate::protocol::*;
|
||||
use std::io;
|
||||
use format;
|
||||
use nbt;
|
||||
use types;
|
||||
use item;
|
||||
use shared::Position;
|
||||
use crate::format;
|
||||
use crate::nbt;
|
||||
use crate::types;
|
||||
use crate::item;
|
||||
use crate::shared::Position;
|
||||
|
||||
|
||||
pub mod internal_ids {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use format;
|
||||
use crate::format;
|
||||
|
||||
state_packets!(
|
||||
handshake Handshaking {
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::sync::{Arc, RwLock};
|
|||
|
||||
use cgmath::{Point3, Matrix4};
|
||||
use byteorder::{WriteBytesExt, NativeEndian};
|
||||
use gl;
|
||||
use crate::gl;
|
||||
use super::glsl;
|
||||
|
||||
pub struct Clouds {
|
||||
|
|
|
@ -23,18 +23,18 @@ pub mod clouds;
|
|||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::io::Write;
|
||||
use resources;
|
||||
use gl;
|
||||
use crate::resources;
|
||||
use crate::gl;
|
||||
use image;
|
||||
use image::{GenericImage, GenericImageView};
|
||||
use byteorder::{WriteBytesExt, NativeEndian};
|
||||
use serde_json;
|
||||
use cgmath::prelude::*;
|
||||
use world;
|
||||
use crate::world;
|
||||
use collision;
|
||||
|
||||
use std::hash::BuildHasherDefault;
|
||||
use types::hash::FNVHash;
|
||||
use crate::types::hash::FNVHash;
|
||||
use std::sync::atomic::{AtomicIsize, Ordering};
|
||||
use std::thread;
|
||||
use std::sync::mpsc;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
|
||||
use super::glsl;
|
||||
use super::shaders;
|
||||
use gl;
|
||||
use crate::gl;
|
||||
use cgmath::{Point3, Matrix4, SquareMatrix};
|
||||
use collision::{self, Frustum, Sphere};
|
||||
use std::collections::HashMap;
|
||||
use std::hash::BuildHasherDefault;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use types::hash::FNVHash;
|
||||
use shared::Direction;
|
||||
use crate::types::hash::FNVHash;
|
||||
use crate::shared::Direction;
|
||||
use byteorder::{WriteBytesExt, NativeEndian};
|
||||
use model::BlockVertex;
|
||||
use format::{self, Component};
|
||||
use crate::model::BlockVertex;
|
||||
use crate::format::{self, Component};
|
||||
|
||||
pub struct Manager {
|
||||
collections: Vec<Collection>,
|
||||
|
@ -382,7 +382,7 @@ impl <'a> FormatState<'a> {
|
|||
let texture = self.renderer.ui.character_texture(ch);
|
||||
let w = self.renderer.ui.size_of_char(ch) as f32;
|
||||
|
||||
for vert in ::model::BlockVertex::face_by_direction(Direction::North) {
|
||||
for vert in crate::model::BlockVertex::face_by_direction(Direction::North) {
|
||||
self.text.push(Vertex {
|
||||
x: vert.x * self.x_scale * w - (self.offset + w * self.x_scale),
|
||||
y: vert.y * self.y_scale + 2.1 / 16.0,
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use render::glsl;
|
||||
use gl;
|
||||
use crate::render::glsl;
|
||||
use crate::gl;
|
||||
|
||||
pub fn add_shaders(reg: &mut glsl::Registry) {
|
||||
reg.register("lookup_texture", include_str!("shaders/lookup_texture.glsl"));
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::collections::HashMap;
|
||||
use resources;
|
||||
use gl;
|
||||
use render;
|
||||
use render::glsl;
|
||||
use render::shaders;
|
||||
use crate::resources;
|
||||
use crate::gl;
|
||||
use crate::render;
|
||||
use crate::render::glsl;
|
||||
use crate::render::shaders;
|
||||
use byteorder::{WriteBytesExt, NativeEndian};
|
||||
use image;
|
||||
use image::GenericImageView;
|
||||
|
|
|
@ -27,8 +27,8 @@ use serde_json;
|
|||
use reqwest;
|
||||
use zip;
|
||||
|
||||
use types::hash::FNVHash;
|
||||
use ui;
|
||||
use crate::types::hash::FNVHash;
|
||||
use crate::ui;
|
||||
|
||||
const RESOURCES_VERSION: &'static str = "1.11";
|
||||
const VANILLA_CLIENT_URL: &'static str = "https://launcher.mojang.com/mc/game/1.11/client/780e46b3a96091a7f42c028c615af45974629072/client.jar";
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use ui;
|
||||
use render;
|
||||
use crate::ui;
|
||||
use crate::render;
|
||||
|
||||
pub struct Connecting {
|
||||
elements: Option<UIElements>,
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
use std::fs;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use ui;
|
||||
use render;
|
||||
use crate::ui;
|
||||
use crate::render;
|
||||
|
||||
use serde_json::{self, Value};
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ use std::thread;
|
|||
|
||||
use rand::{self, Rng};
|
||||
|
||||
use ui;
|
||||
use render;
|
||||
use console;
|
||||
use protocol;
|
||||
use protocol::mojang;
|
||||
use auth;
|
||||
use crate::ui;
|
||||
use crate::render;
|
||||
use crate::console;
|
||||
use crate::protocol;
|
||||
use crate::protocol::mojang;
|
||||
use crate::auth;
|
||||
|
||||
pub struct Login {
|
||||
elements: Option<UIElements>,
|
||||
|
|
|
@ -23,8 +23,8 @@ pub mod edit_server;
|
|||
pub mod settings_menu;
|
||||
pub use self::settings_menu::{SettingsMenu, VideoSettingsMenu, AudioSettingsMenu};
|
||||
|
||||
use render;
|
||||
use ui;
|
||||
use crate::render;
|
||||
use crate::ui;
|
||||
|
||||
pub trait Screen {
|
||||
// Called once
|
||||
|
|
|
@ -18,11 +18,11 @@ use std::sync::mpsc;
|
|||
use std::rc::Rc;
|
||||
use std::cell::RefCell;
|
||||
|
||||
use ui;
|
||||
use render;
|
||||
use format;
|
||||
use format::{Component, TextComponent};
|
||||
use protocol;
|
||||
use crate::ui;
|
||||
use crate::render;
|
||||
use crate::format;
|
||||
use crate::format::{Component, TextComponent};
|
||||
use crate::protocol;
|
||||
|
||||
use serde_json;
|
||||
use std::time::{Duration};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use console;
|
||||
use render;
|
||||
use ui;
|
||||
use settings;
|
||||
use crate::console;
|
||||
use crate::render;
|
||||
use crate::ui;
|
||||
use crate::settings;
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
|
@ -12,25 +12,25 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use protocol::{self, mojang, packet};
|
||||
use world;
|
||||
use world::block;
|
||||
use crate::protocol::{self, mojang, packet};
|
||||
use crate::world;
|
||||
use crate::world::block;
|
||||
use rand::{self, Rng};
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::sync::mpsc;
|
||||
use std::thread;
|
||||
use std::collections::HashMap;
|
||||
use std::hash::BuildHasherDefault;
|
||||
use types::hash::FNVHash;
|
||||
use resources;
|
||||
use render;
|
||||
use settings::Stevenkey;
|
||||
use ecs;
|
||||
use entity;
|
||||
use crate::types::hash::FNVHash;
|
||||
use crate::resources;
|
||||
use crate::render;
|
||||
use crate::settings::Stevenkey;
|
||||
use crate::ecs;
|
||||
use crate::entity;
|
||||
use cgmath::prelude::*;
|
||||
use types::Gamemode;
|
||||
use shared::{Axis, Position};
|
||||
use format;
|
||||
use crate::types::Gamemode;
|
||||
use crate::shared::{Axis, Position};
|
||||
use crate::format;
|
||||
use rsa_public_encrypt_pkcs1;
|
||||
|
||||
mod sun;
|
||||
|
@ -508,7 +508,7 @@ impl Server {
|
|||
}
|
||||
|
||||
pub fn on_right_click(&mut self, renderer: &mut render::Renderer) {
|
||||
use shared::Direction;
|
||||
use crate::shared::Direction;
|
||||
if self.player.is_some() {
|
||||
if let Some((pos, _, face, at)) = target::trace_ray(&self.world, 4.0, renderer.camera.pos.to_vec(), renderer.view_vector.cast().unwrap(), target::test_block) {
|
||||
self.write_packet(packet::play::serverbound::PlayerBlockPlacement {
|
||||
|
@ -722,7 +722,7 @@ impl Server {
|
|||
},
|
||||
Some(nbt) => {
|
||||
if block_update.action == 9 {
|
||||
use format;
|
||||
use crate::format;
|
||||
let line1 = format::Component::from_string(nbt.1.get("Text1").unwrap().as_str().unwrap());
|
||||
let line2 = format::Component::from_string(nbt.1.get("Text2").unwrap().as_str().unwrap());
|
||||
let line3 = format::Component::from_string(nbt.1.get("Text3").unwrap().as_str().unwrap());
|
||||
|
@ -740,7 +740,7 @@ impl Server {
|
|||
}
|
||||
|
||||
fn on_player_info(&mut self, player_info: packet::play::clientbound::PlayerInfo) {
|
||||
use protocol::packet::PlayerDetail::*;
|
||||
use crate::protocol::packet::PlayerDetail::*;
|
||||
use base64;
|
||||
use serde_json;
|
||||
for detail in player_info.inner.players {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
use protocol::Serializable;
|
||||
use protocol::packet::play::serverbound::PluginMessageServerbound;
|
||||
use crate::protocol::Serializable;
|
||||
use crate::protocol::packet::play::serverbound::PluginMessageServerbound;
|
||||
|
||||
pub struct Brand {
|
||||
pub brand: String,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
use render;
|
||||
use render::model;
|
||||
use crate::render;
|
||||
use crate::render::model;
|
||||
use cgmath::{Vector3, Matrix4, Decomposed, Rotation3, Rad, Quaternion};
|
||||
|
||||
pub struct SunModel {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
use world;
|
||||
use world::block;
|
||||
use shared::{Position, Direction};
|
||||
use crate::world;
|
||||
use crate::world::block;
|
||||
use crate::shared::{Position, Direction};
|
||||
use cgmath;
|
||||
use render;
|
||||
use render::model;
|
||||
use crate::render;
|
||||
use crate::render::model;
|
||||
use collision::{self, Aabb};
|
||||
|
||||
pub struct Info {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use console;
|
||||
use crate::console;
|
||||
use std::marker::PhantomData;
|
||||
use sdl2::keyboard::Keycode;
|
||||
// Might just rename this to settings.rs
|
||||
|
|
|
@ -16,11 +16,11 @@ use std::collections::HashMap;
|
|||
use std::marker::PhantomData;
|
||||
use std::io;
|
||||
use std::fmt;
|
||||
use protocol;
|
||||
use protocol::Serializable;
|
||||
use format;
|
||||
use item;
|
||||
use shared::Position;
|
||||
use crate::protocol;
|
||||
use crate::protocol::Serializable;
|
||||
use crate::format;
|
||||
use crate::item;
|
||||
use crate::shared::Position;
|
||||
|
||||
pub struct MetadataKey<T: MetaValue> {
|
||||
index: i32,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::f64::consts;
|
||||
use ui;
|
||||
use render;
|
||||
use resources;
|
||||
use crate::ui;
|
||||
use crate::render;
|
||||
use crate::resources;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use rand;
|
||||
use rand::Rng;
|
||||
|
|
|
@ -16,8 +16,8 @@ pub mod logo;
|
|||
|
||||
use std::rc::{Rc, Weak};
|
||||
use std::cell::{RefCell, RefMut};
|
||||
use render;
|
||||
use format;
|
||||
use crate::render;
|
||||
use crate::format;
|
||||
use sdl2::keyboard::Keycode;
|
||||
|
||||
const SCALED_WIDTH: f64 = 854.0;
|
||||
|
@ -161,7 +161,7 @@ macro_rules! define_elements {
|
|||
}
|
||||
}
|
||||
|
||||
fn hover_at(&self, r: &Region, game: &mut ::Game, mx: f64, my: f64, sw: f64, sh: f64) -> bool {
|
||||
fn hover_at(&self, r: &Region, game: &mut crate::Game, mx: f64, my: f64, sw: f64, sh: f64) -> bool {
|
||||
match *self {
|
||||
$(
|
||||
Element::$name(ref inner) => {
|
||||
|
@ -172,7 +172,7 @@ macro_rules! define_elements {
|
|||
}
|
||||
}
|
||||
|
||||
fn click_at(&self, r: &Region, game: &mut ::Game, mx: f64, my: f64, sw: f64, sh: f64) -> bool {
|
||||
fn click_at(&self, r: &Region, game: &mut crate::Game, mx: f64, my: f64, sw: f64, sh: f64) -> bool {
|
||||
match *self {
|
||||
$(
|
||||
Element::$name(ref inner) => {
|
||||
|
@ -183,7 +183,7 @@ macro_rules! define_elements {
|
|||
}
|
||||
}
|
||||
|
||||
fn key_press(&self, game: &mut ::Game, key: Keycode, down: bool, ctrl_pressed: bool) {
|
||||
fn key_press(&self, game: &mut crate::Game, key: Keycode, down: bool, ctrl_pressed: bool) {
|
||||
match *self {
|
||||
$(
|
||||
Element::$name(ref inner) => {
|
||||
|
@ -193,7 +193,7 @@ macro_rules! define_elements {
|
|||
)*
|
||||
}
|
||||
}
|
||||
fn key_type(&self, game: &mut ::Game, c: char) {
|
||||
fn key_type(&self, game: &mut crate::Game, c: char) {
|
||||
match *self {
|
||||
$(
|
||||
Element::$name(ref inner) => {
|
||||
|
@ -340,7 +340,7 @@ impl Container {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn hover_at(&mut self, game: &mut ::Game, x: f64, y: f64, width: f64, height: f64) {
|
||||
pub fn hover_at(&mut self, game: &mut crate::Game, x: f64, y: f64, width: f64, height: f64) {
|
||||
let (sw, sh) = match self.mode {
|
||||
Mode::Scaled => (SCALED_WIDTH / width, SCALED_HEIGHT / height),
|
||||
Mode::Unscaled(scale) => (scale, scale),
|
||||
|
@ -354,7 +354,7 @@ impl Container {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn click_at(&mut self, game: &mut ::Game, x: f64, y: f64, width: f64, height: f64) {
|
||||
pub fn click_at(&mut self, game: &mut crate::Game, x: f64, y: f64, width: f64, height: f64) {
|
||||
let (sw, sh) = match self.mode {
|
||||
Mode::Scaled => (SCALED_WIDTH / width, SCALED_HEIGHT / height),
|
||||
Mode::Unscaled(scale) => (scale, scale),
|
||||
|
@ -395,7 +395,7 @@ impl Container {
|
|||
focusables[next_focus].set_focused(true);
|
||||
}
|
||||
|
||||
pub fn key_press(&mut self, game: &mut ::Game, key: Keycode, down: bool, ctrl_pressed: bool) {
|
||||
pub fn key_press(&mut self, game: &mut crate::Game, key: Keycode, down: bool, ctrl_pressed: bool) {
|
||||
if key == Keycode::Tab {
|
||||
if !down {
|
||||
self.cycle_focus();
|
||||
|
@ -410,7 +410,7 @@ impl Container {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn key_type(&mut self, game: &mut ::Game, c: char) {
|
||||
pub fn key_type(&mut self, game: &mut crate::Game, c: char) {
|
||||
if c < ' ' {
|
||||
return;
|
||||
}
|
||||
|
@ -465,8 +465,8 @@ trait UIElement {
|
|||
fn get_size(&self) -> (f64, f64);
|
||||
fn is_dirty(&self) -> bool;
|
||||
fn post_init(_: Rc<RefCell<Self>>) {}
|
||||
fn key_press(&mut self, _game: &mut ::Game, _key: Keycode, _down: bool, _ctrl_pressed: bool) {}
|
||||
fn key_type(&mut self, _game: &mut ::Game, _c: char) {}
|
||||
fn key_press(&mut self, _game: &mut crate::Game, _key: Keycode, _down: bool, _ctrl_pressed: bool) {}
|
||||
fn key_type(&mut self, _game: &mut crate::Game, _c: char) {}
|
||||
fn tick(&mut self, renderer: &mut render::Renderer);
|
||||
}
|
||||
|
||||
|
@ -498,9 +498,9 @@ macro_rules! element {
|
|||
data: Vec<u8>,
|
||||
needs_rebuild: bool,
|
||||
|
||||
hover_funcs: Vec<Box<Fn(&mut $name, bool, &mut ::Game) -> bool>>,
|
||||
hover_funcs: Vec<Box<Fn(&mut $name, bool, &mut crate::Game) -> bool>>,
|
||||
hover_state: bool,
|
||||
click_funcs: Vec<Box<Fn(&mut $name, &mut ::Game) -> bool>>,
|
||||
click_funcs: Vec<Box<Fn(&mut $name, &mut crate::Game) -> bool>>,
|
||||
|
||||
focused: bool,
|
||||
|
||||
|
@ -578,7 +578,7 @@ macro_rules! element {
|
|||
}
|
||||
}
|
||||
|
||||
fn hover_at(&mut self, super_region: &Region, game: &mut ::Game, mx: f64, my: f64, sw: f64, sh: f64) -> bool {
|
||||
fn hover_at(&mut self, super_region: &Region, game: &mut crate::Game, mx: f64, my: f64, sw: f64, sh: f64) -> bool {
|
||||
use std::mem;
|
||||
let mut handle_self = true;
|
||||
for e in &self.elements {
|
||||
|
@ -607,11 +607,11 @@ macro_rules! element {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn add_hover_func<F: Fn(&mut $name, bool, &mut ::Game) -> bool + 'static>(&mut self, func: F) {
|
||||
pub fn add_hover_func<F: Fn(&mut $name, bool, &mut crate::Game) -> bool + 'static>(&mut self, func: F) {
|
||||
self.hover_funcs.push(Box::new(func));
|
||||
}
|
||||
|
||||
fn click_at(&mut self, super_region: &Region, game: &mut ::Game, mx: f64, my: f64, sw: f64, sh: f64) -> bool {
|
||||
fn click_at(&mut self, super_region: &Region, game: &mut crate::Game, mx: f64, my: f64, sw: f64, sh: f64) -> bool {
|
||||
use std::mem;
|
||||
let mut handle_self = true;
|
||||
for e in &self.elements {
|
||||
|
@ -636,7 +636,7 @@ macro_rules! element {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn add_click_func<F: Fn(&mut $name, &mut ::Game) -> bool + 'static>(&mut self, func: F) {
|
||||
pub fn add_click_func<F: Fn(&mut $name, &mut crate::Game) -> bool + 'static>(&mut self, func: F) {
|
||||
self.click_funcs.push(Box::new(func));
|
||||
}
|
||||
|
||||
|
@ -1285,7 +1285,7 @@ element! {
|
|||
priv text: Option<TextRef>,
|
||||
priv was_focused: bool,
|
||||
priv cursor_tick: f64,
|
||||
priv submit_funcs: Vec<Box<Fn(&mut TextBox, &mut ::Game)>>,
|
||||
priv submit_funcs: Vec<Box<Fn(&mut TextBox, &mut crate::Game)>>,
|
||||
}
|
||||
builder TextBoxBuilder {
|
||||
hardcode button = None,
|
||||
|
@ -1309,7 +1309,7 @@ impl TextBoxBuilder {
|
|||
}
|
||||
|
||||
impl UIElement for TextBox {
|
||||
fn key_press(&mut self, game: &mut ::Game, key: Keycode, down: bool, ctrl_pressed: bool) {
|
||||
fn key_press(&mut self, game: &mut crate::Game, key: Keycode, down: bool, ctrl_pressed: bool) {
|
||||
match (key, down) {
|
||||
(Keycode::Backspace, false) => {self.input.pop();},
|
||||
(Keycode::Return, false) => {
|
||||
|
@ -1334,7 +1334,7 @@ impl UIElement for TextBox {
|
|||
}
|
||||
}
|
||||
|
||||
fn key_type(&mut self, _game: &mut ::Game, c: char) {
|
||||
fn key_type(&mut self, _game: &mut crate::Game, c: char) {
|
||||
self.input.push(c);
|
||||
}
|
||||
|
||||
|
@ -1392,7 +1392,7 @@ impl UIElement for TextBox {
|
|||
}
|
||||
|
||||
impl TextBox {
|
||||
pub fn add_submit_func<F: Fn(&mut TextBox, &mut ::Game) + 'static>(&mut self, f: F) {
|
||||
pub fn add_submit_func<F: Fn(&mut TextBox, &mut crate::Game) + 'static>(&mut self, f: F) {
|
||||
self.submit_funcs.push(Box::new(f));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,17 +17,17 @@ pub use steven_blocks as block;
|
|||
use std::collections::HashMap;
|
||||
use std::collections::VecDeque;
|
||||
use std::hash::BuildHasherDefault;
|
||||
use types::{bit, nibble};
|
||||
use shared::{Position, Direction};
|
||||
use types::hash::FNVHash;
|
||||
use protocol;
|
||||
use render;
|
||||
use crate::types::{bit, nibble};
|
||||
use crate::shared::{Position, Direction};
|
||||
use crate::types::hash::FNVHash;
|
||||
use crate::protocol;
|
||||
use crate::render;
|
||||
use collision;
|
||||
use cgmath::prelude::*;
|
||||
use chunk_builder;
|
||||
use ecs;
|
||||
use entity::block_entity;
|
||||
use format;
|
||||
use crate::chunk_builder;
|
||||
use crate::ecs;
|
||||
use crate::entity::block_entity;
|
||||
use crate::format;
|
||||
|
||||
pub mod biome;
|
||||
mod storage;
|
||||
|
@ -317,7 +317,7 @@ impl World {
|
|||
}
|
||||
|
||||
pub fn compute_render_list(&mut self, renderer: &mut render::Renderer) {
|
||||
use chunk_builder;
|
||||
use crate::chunk_builder;
|
||||
use std::collections::VecDeque;
|
||||
self.render_list.clear();
|
||||
|
||||
|
@ -548,7 +548,7 @@ impl World {
|
|||
pub fn load_chunk(&mut self, x: i32, z: i32, new: bool, mask: u16, data: Vec<u8>) -> Result<(), protocol::Error> {
|
||||
use std::io::{Cursor, Read};
|
||||
use byteorder::ReadBytesExt;
|
||||
use protocol::{VarInt, Serializable, LenPrefixed};
|
||||
use crate::protocol::{VarInt, Serializable, LenPrefixed};
|
||||
|
||||
let mut data = Cursor::new(data);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
use types::bit;
|
||||
use types::hash::FNVHash;
|
||||
use world::block;
|
||||
use crate::types::bit;
|
||||
use crate::types::hash::FNVHash;
|
||||
use crate::world::block;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::hash::BuildHasherDefault;
|
||||
|
|
Loading…
Reference in New Issue