Skip to content

Commit

Permalink
rearrange files in folders
Browse files Browse the repository at this point in the history
  • Loading branch information
o2sh committed Dec 29, 2020
1 parent 9f4871a commit 047deda
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 22 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = LF
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{yml,yaml,md}]
indent_size = 2

[*.ascii]
trim_trailing_whitespace = false

[{Makefile,.SRCINFO}]
indent_style = tab
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2018"
readme = "README.md"
license = "MIT"
repository = "https://github.com/o2sh/teki"
exclude = ["resources/*"]


[dependencies]
Expand Down
Binary file added assets/vine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/teki.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 4 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
mod app;
mod components;
mod consts;
mod pad;
mod sdl_renderer;
mod system_player;
mod teki;

use clap::{crate_description, crate_name, crate_version, App, Arg};

use app::EcsApp;
use sdl2::event::Event;
use sdl2::image::{self, InitFlag};
use sdl2::Sdl;
use sdl_renderer::SdlRenderer;
use std::time::Duration;
use teki::ecs::app::EcsApp;
use teki::sdl::sdl_renderer::SdlRenderer;

use consts::*;
use teki::consts::*;

#[derive(Clone, Copy, PartialEq)]

Expand Down
2 changes: 1 addition & 1 deletion src/consts.rs → src/teki/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ pub const CENTER_X: i32 = WIDTH / 2;
pub const PLAYER_Y: i32 = HEIGHT - 16 - 8;

pub const APP_NAME: &str = "Teki";
pub const PLAYER_SPEED: i32 = 20;
pub const PLAYER_SPEED: i32 = 10;
pub const MYSHOT_SPEED: i32 = 6;
pub const FPS: u32 = 60;
14 changes: 6 additions & 8 deletions src/app.rs → src/teki/ecs/app.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::components::*;
use crate::consts::*;
use crate::pad::{Pad, PadBit};
use crate::system_player::*;
use crate::teki::consts::*;
use crate::teki::ecs::components::*;
use crate::teki::ecs::system_player::*;
use crate::teki::pad::{Pad, PadBit};
use crate::SdlRenderer;
use legion::*;
use sdl2::keyboard::Keycode;
Expand Down Expand Up @@ -90,8 +90,7 @@ impl Title {
}

fn draw(&self, renderer: &mut SdlRenderer) {
renderer.set_draw_color(135, 135, 135);
renderer.clear();
renderer.draw_bg("assets/vine.png");

renderer.draw_str("assets/font.png", 10 * 9, 8 * 8, "TEKI");

Expand All @@ -115,9 +114,8 @@ impl Game {
.build();
let mut world = World::default();
world.push((new_player(), Position(Point::new(CENTER_X, PLAYER_Y)), player_sprite()));
let mut resources = Resources::default();

Self { world, resources, schedule }
Self { world, resources: Resources::default(), schedule }
}

fn update(&mut self, pad: &Pad) -> bool {
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions src/teki/ecs/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod app;
pub mod components;
mod system_player;
6 changes: 3 additions & 3 deletions src/system_player.rs → src/teki/ecs/system_player.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::components::*;
use crate::consts::*;
use crate::pad::{Pad, PadBit};
use crate::teki::consts::*;
use crate::teki::ecs::components::*;
use crate::teki::pad::{Pad, PadBit};
use legion::systems::CommandBuffer;
use legion::world::SubWorld;
use legion::*;
Expand Down
4 changes: 4 additions & 0 deletions src/teki/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub mod consts;
pub mod ecs;
mod pad;
pub mod sdl;
File renamed without changes.
1 change: 1 addition & 0 deletions src/teki/sdl/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod sdl_renderer;
2 changes: 1 addition & 1 deletion src/sdl_renderer.rs → src/teki/sdl/sdl_renderer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::components::*;
use crate::teki::ecs::components::*;
use sdl2::image::LoadTexture;
use sdl2::pixels::Color;
use sdl2::rect::Point;
Expand Down

0 comments on commit 047deda

Please sign in to comment.