rsnaker/graphics/mod.rs
1//! # Game graphical Modules
2//! This module contains the core components of the game logic, it includes the following submodules:
3//!
4//! - [`graphic_block`]: Handles the graphical rendering of game logic blocks in the terminal.
5//! - [`sprites`]: Provides the game sprites, as snake, map and so on. .
6//! - [`menus`]: Provides utility functions to assist with common texts and graphical tasks
7
8pub mod graphic_block;
9pub mod sprites;
10
11pub mod menus;
12pub mod playing_render;
13/* Just to have some fun with moving letter
14pub fn left(&mut self) {
15 let mut current: u16 = self.body[0].x;
16 self.body[0].x -= self.CASE_SIZE;
17 let mut previous: u16 = current;
18 for i in 1..self.body.len() {
19 current = self.body[i].x;
20 self.body[i].x = previous;
21 previous = current;
22 }
23 }
24 pub fn right(&mut self) {
25 let mut current: u16 = self.body[0].x;
26 self.body[0].x += self.CASE_SIZE;
27 let mut previous: u16 = current;
28 for i in 1..self.body.len() {
29 current = self.body[i].x;
30 self.body[i].x = previous;
31 previous = current;
32 }
33 }
34 pub fn up(&mut self) {
35 let mut current: u16 = self.body[0].y;
36 self.body[0].y -= self.CASE_SIZE / 2;
37 let mut previous: u16 = current;
38 for i in 1..self.body.len() {
39 current = self.body[i].y;
40 self.body[i].y = previous;
41 previous = current;
42 }
43 }
44 pub fn down(&mut self) {
45 let mut current: u16 = self.body[0].y;
46 self.body[0].y += self.CASE_SIZE / 2;
47 let mut previous: u16 = current;
48 for i in 1..self.body.len() {
49 current = self.body[i].y;
50 self.body[i].y = previous;
51 previous = current;
52 }
53 }
54 */