first commit

master
Droog71 2021-10-16 17:00:51 -04:00
parent 4fdb61633f
commit 006913f9c8
127 changed files with 8054 additions and 0 deletions

53
README.md Normal file
View File

@ -0,0 +1,53 @@
SFMechSimulator
===============
_A pseudo 3D Mech Simulator created with C++ and SFML_ <br />
Pilot a giant robot and battle other giant robots in a psuedo 3D environment. <br />
Repair and upgrade your mech between missions. <br />
Carefully select upgrades and develop winning strategies in combat. <br />
<img src="https://i.imgur.com/Kt5mlTH.png" alt="SF Mech Sim" width="427" height="240">
**Compiling** <br />
_Windows:_ <br />
Download SFML and GCC here https://www.sfml-dev.org/download/sfml/2.5.1/ <br />
You will need 'MinGW Builds 7.3.0 (64-bit)' and SFML 'GCC 7.3.0 MinGW (SEH) - 64-bit' <br />
For 32 bit systems you will need 'MinGW Builds 7.3.0 (32-bit)' and 'GCC 7.3.0 MinGW (DW2) - 32-bit' <br />
Clone this repository to C:\ so the source code is present at C:\SFMechSimulator <br />
Extract the downloaded SFML package to C:\ so SFML is present at C:\SFML-2.5.1 <br />
Run the compile_windows.bat script <br />
Run SFMechSimulator.exe to play the game <br />
To run the game in a window, use the command line argument '-window' <br />
ie: 'SFMechSimulator.exe -window 1280 720' <br />
The window cannot be smaller than 1280x720 <br />
_Mac:_ <br />
Clone this repository. <br />
Install g++ as described here http://www.edparrish.net/common/macgpp.php#installg++ <br />
Download SFML here https://www.sfml-dev.org/download/sfml/2.5.1/ <br />
Copy the contents of the SFML Frameworks and extlibs directories to /Library/Frameworks <br />
Run the compile_mac.sh script <br />
Run the SFMechSimulator executable to play the game <br />
To run the game in a window, use the command line argument '-window' <br />
ie: './SFMechSimulator -window 1280 720' <br />
The window cannot be smaller than 1280x720 <br />
_Linux:_ <br />
Clone this repository. <br />
Install SFML, ie: 'sudo apt-get install libsfml-dev' <br />
Run the compile_linux.sh script <br />
Run the SFMechSimulator executable to play the game <br />
To run the game in a window, use the command line argument '-window' <br />
ie: './SFMechSimulator -window 1280 720' <br />
The window cannot be smaller than 1280x720 <br />
**Playing the Game** <br />
Click the 'NEW GAME' button at the main menu <br />
Press F1 to start the tutorial <br />

Binary file not shown.

BIN
assets/Orbitron Medium.ttf Normal file

Binary file not shown.

BIN
assets/sounds/cannon.ogg Normal file

Binary file not shown.

BIN
assets/sounds/crash.ogg Normal file

Binary file not shown.

BIN
assets/sounds/explosion.ogg Normal file

Binary file not shown.

BIN
assets/sounds/guns.ogg Normal file

Binary file not shown.

BIN
assets/sounds/hydraulic.ogg Normal file

Binary file not shown.

BIN
assets/sounds/impact.ogg Normal file

Binary file not shown.

Binary file not shown.

BIN
assets/sounds/main_menu.ogg Normal file

Binary file not shown.

BIN
assets/sounds/mission.ogg Normal file

Binary file not shown.

Binary file not shown.

BIN
assets/sounds/power_up.ogg Normal file

Binary file not shown.

BIN
assets/sounds/purchase.ogg Normal file

Binary file not shown.

BIN
assets/sounds/stomp.ogg Normal file

Binary file not shown.

BIN
assets/sounds/victory.ogg Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

BIN
assets/textures/ground.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B

BIN
assets/textures/sky.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

BIN
assets/textures/sky_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 971 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

BIN
assets/textures/term.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
assets/textures/tree.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
assets/textures/tree_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
assets/textures/tree_3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
assets/textures/tree_4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
assets/textures/wall.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 KiB

BIN
assets/textures/wall_2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

16
bindings.list Normal file
View File

@ -0,0 +1,16 @@
throttle_up:W
throttle_down:S
turn_left:A
turn_right:D
look_left:Left
look_right:Right
look_up:Up
look_down:Down
fire_guns:Space
fire_cannon:LControl
lock_target:T
select_component:C
map:M
show_tutorial:F1
show_keys:F2
show_fps:F3

2
compile_linux.sh Executable file
View File

@ -0,0 +1,2 @@
#! /bin/bash
g++ main.cpp $PWD/src/settings_menu.cpp $PWD/src/cockpit.cpp $PWD/src/settings.cpp $PWD/src/market_menu.cpp $PWD/src/tutorial.cpp $PWD/src/key_bindings.cpp $PWD/src/assets.cpp $PWD/src/calc_helper.cpp $PWD/src/entity.cpp $PWD/src/file_handler.cpp $PWD/src/hud.cpp $PWD/src/intermission_menu.cpp $PWD/src/main_menu.cpp $PWD/src/mech.cpp $PWD/src/player_controller.cpp $PWD/src/world_generator.cpp -Iinclude -o SFMechSimulator -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system

3
compile_mac.sh Executable file
View File

@ -0,0 +1,3 @@
#! /bin/bash
g++ -std=c++11 -F/Library/Frameworks -Iinclude -framework sfml-window -framework sfml-graphics -framework sfml-audio -framework sfml-system main.cpp $PWD/src/settings_menu.cpp $PWD/src/cockpit.cpp $PWD/src/settings.cpp $PWD/src/market_menu.cpp $PWD/src/tutorial.cpp $PWD/src/key_bindings.cpp $PWD/src/assets.cpp $PWD/src/calc_helper.cpp $PWD/src/entity.cpp $PWD/src/file_handler.cpp $PWD/src/hud.cpp $PWD/src/intermission_menu.cpp $PWD/src/main_menu.cpp $PWD/src/mech.cpp $PWD/src/player_controller.cpp $PWD/src/world_generator.cpp -o SFMechSimulator

18
compile_windows.bat Normal file
View File

@ -0,0 +1,18 @@
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\main.cpp -o obj\Release\main.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\assets.cpp -o obj\Release\src\assets.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\calc_helper.cpp -o obj\Release\src\calc_helper.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\cockpit.cpp -o obj\Release\src\cockpit.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\entity.cpp -o obj\Release\src\entity.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\file_handler.cpp -o obj\Release\src\file_handler.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\hud.cpp -o obj\Release\src\hud.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\intermission_menu.cpp -o obj\Release\src\intermission_menu.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\key_bindings.cpp -o obj\Release\src\key_bindings.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\main_menu.cpp -o obj\Release\src\main_menu.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\market_menu.cpp -o obj\Release\src\market_menu.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\mech.cpp -o obj\Release\src\mech.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\player_controller.cpp -o obj\Release\src\player_controller.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\settings.cpp -o obj\Release\src\settings.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\settings_menu.cpp -o obj\Release\src\settings_menu.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\tutorial.cpp -o obj\Release\src\tutorial.o
g++.exe -Wall -O2 -IC:\SFML-2.5.1\include -Iinclude -Isrc -c C:\SFMechSimulator\src\world_generator.cpp -o obj\Release\src\world_generator.o
g++.exe -LC:\SFML-2.5.1\lib -o bin\Release\SFMechSimulator.exe obj\Release\main.o obj\Release\src\assets.o obj\Release\src\calc_helper.o obj\Release\src\cockpit.o obj\Release\src\entity.o obj\Release\src\file_handler.o obj\Release\src\hud.o obj\Release\src\intermission_menu.o obj\Release\src\key_bindings.o obj\Release\src\main_menu.o obj\Release\src\market_menu.o obj\Release\src\mech.o obj\Release\src\player_controller.o obj\Release\src\settings.o obj\Release\src\settings_menu.o obj\Release\src\tutorial.o obj\Release\src\world_generator.o -s -lmingw32 -luser32 -lgdi32 -lwinmm -ldxguid -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system -mwindows

30
credits.txt Normal file
View File

@ -0,0 +1,30 @@
main menu music: https://freesound.org/people/LittleRobotSoundFactory/sounds/274169/
intermission music: https://freesound.org/people/szegvari/sounds/560746/
mission music: https://freesound.org/people/FoolBoyMedia/sounds/270366/
victory sound: https://freesound.org/people/joshuaempyre/sounds/404024/
gun sound: https://freesound.org/people/CJDeets/sounds/476740/
cannon sound: https://freesound.org/people/Kneeling/sounds/448002/
power up sound: https://freesound.org/people/Breviceps/sounds/557593/
power down sound: https://freesound.org/people/qubodup/sounds/222372/
stomp sound: https://freesound.org/people/studiomandragore/sounds/401628/
crash sound: https://freesound.org/people/qubodup/sounds/182429/
impact sound: https://freesound.org/people/Oddworld/sounds/75328/
hydraulic sound: https://freesound.org/people/eardeer/sounds/385083/
mech sprite: https://opengameart.org/content/unit-666-mech
dead tree sprites: https://opengameart.org/content/knarled-trees
green tree sprites: https://opengameart.org/content/tree-collection-v26-bleeds-game-art
cannon effect: https://opengameart.org/content/blue-fire-effect
small explosion sprites: https://gaph.artstation.com/
large explosion sprite: https://www.freepngimg.com/png/31556-atomic-explosion-transparent-background
menu background and sky: https://free-images.com/lg/5434/planet_earth_moon_science.jpg
welder: https://opengameart.org/content/16-bit-alien
welding sparks: https://opengameart.org/content/spark-particles-set-of-8
skull and bones: https://openclipart.org/image/400px/1010
sky: https://svs.gsfc.nasa.gov/3895
moon: https://www.publicdomainpictures.net/en/view-image.php?image=44955&picture=full-moon-at-midnight-close-up
blue sky: https://www.pexels.com/photo/blue-and-white-sky-with-stars-4737484/
orbitron font: https://www.1001freefonts.com/orbitron.font
exoplanetaria font: https://www.fontspace.com/exoplanetaria-font-f41401

182
include/assets.h Normal file
View File

@ -0,0 +1,182 @@
#ifndef ASSETS_H
#define ASSETS_H
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
class assets
{
public:
// Sounds
sf::SoundBuffer gun_sound_buffer;
sf::Sound gun_sound;
sf::SoundBuffer cannon_sound_buffer;
sf::Sound cannon_sound;
sf::SoundBuffer explo_sound_buffer;
sf::Sound explosion_sound;
sf::SoundBuffer hydraulic_sound_buffer;
sf::Sound hydraulic_sound;
sf::SoundBuffer stomp_sound_buffer;
sf::Sound stomp_sound;
sf::SoundBuffer crash_sound_buffer;
sf::Sound crash_sound;
sf::SoundBuffer impact_sound_buffer;
sf::Sound impact_sound;
sf::SoundBuffer power_down_sound_buffer;
sf::Sound power_down_sound;
sf::SoundBuffer power_up_sound_buffer;
sf::Sound power_up_sound;
sf::SoundBuffer purchase_sound_buffer;
sf::Sound purchase_sound;
sf::SoundBuffer main_menu_music_buffer;
sf::Sound main_menu_music;
sf::SoundBuffer intermission_music_buffer;
sf::Sound intermission_music;
sf::SoundBuffer mission_music_buffer;
sf::Sound mission_music;
sf::SoundBuffer victory_sound_buffer;
sf::Sound victory_sound;
// Textures
sf::Texture mech_status_texture;
sf::Texture mech_texture;
sf::Texture mech_fire_guns_texture;
sf::Texture mech_fire_guns_left_texture;
sf::Texture mech_fire_guns_right_texture;
sf::Texture mech_fire_cannons_texture;
sf::Texture mech_fire_cannons_left_texture;
sf::Texture mech_fire_cannons_right_texture;
sf::Texture mech_hit_center_texture;
sf::Texture mech_hit_left_leg_texture;
sf::Texture mech_hit_right_leg_texture;
sf::Texture mech_hit_left_arm_texture;
sf::Texture mech_hit_right_arm_texture;
sf::Texture mech_hit_cockpit_texture;
std::vector<sf::Texture> mech_textures;
sf::Texture cockpit_texture;
sf::Texture cockpit_fire_texture;
sf::Texture cockpit_fire_left_texture;
sf::Texture cockpit_fire_right_texture;
sf::Texture cockpit_cannon_texture;
sf::Texture cockpit_cannon_left_texture;
sf::Texture cockpit_cannon_right_texture;
sf::Texture cockpit_impact_texture;
sf::Texture cockpit_destroyed_texture;
sf::Texture explosion_texture;
sf::Texture crosshair_texture;
sf::Texture ground_texture;
sf::Texture ground_2_texture;
sf::Sprite ground_sprite;
sf::Texture sky_texture;
sf::Texture sky_2_texture;
sf::Texture wall_texture;
sf::Texture wall_2_texture;
sf::Texture tree_texture;
sf::Texture tree_2_texture;
sf::Texture tree_3_texture;
sf::Texture tree_4_texture;
sf::Texture player_icon_texture;
sf::Texture mob_icon_texture;
sf::Texture target_icon_texture;
sf::Texture wall_icon_texture;
sf::Texture gui_background_texture;
sf::Texture gui_background_2_texture;
sf::Texture target_gui_background_texture;
sf::Texture menu_background_texture;
sf::Texture menu_mech_texture;
sf::Texture menu_mech_spark_1_texture;
sf::Texture menu_mech_spark_2_texture;
sf::Texture term_texture;
sf::Texture start_game_button_texture;
sf::Texture start_game_button_hover_texture;
sf::Texture main_menu_button_texture;
sf::Texture main_menu_button_hover_texture;
sf::Texture save_game_button_texture;
sf::Texture save_game_button_hover_texture;
sf::Texture load_game_button_texture;
sf::Texture load_game_button_hover_texture;
sf::Texture next_mission_button_texture;
sf::Texture next_mission_button_hover_texture;
sf::Texture repair_button_texture;
sf::Texture repair_button_hover_texture;
sf::Texture market_button_texture;
sf::Texture market_button_hover_texture;
sf::Texture exit_game_button_texture;
sf::Texture exit_game_button_hover_texture;
sf::Texture create_new_button_texture;
sf::Texture create_new_button_hover_texture;
sf::Texture cancel_button_texture;
sf::Texture cancel_button_hover_texture;
sf::Texture options_button_texture;
sf::Texture options_button_hover_texture;
// Sprites
sf::Sprite cockpit_sprite;
sf::Sprite sky_sprite;
sf::Sprite map_sprite;
sf::Sprite term_sprite;
sf::Sprite crosshair_sprite;
sf::Sprite player_icon;
sf::Sprite mob_icon;
sf::Sprite wall_icon;
sf::Sprite target_icon;
sf::Sprite start_game_button_sprite;
sf::Sprite main_menu_button_sprite;
sf::Sprite save_game_button_sprite;
sf::Sprite create_new_button_sprite;
sf::Sprite cancel_button_sprite;
sf::Sprite load_game_button_sprite;
sf::Sprite options_button_sprite;
sf::Sprite next_mission_button_sprite;
sf::Sprite repair_button_sprite;
sf::Sprite market_button_sprite;
sf::Sprite exit_game_button_sprite;
sf::Sprite menu_background_sprite;
sf::Sprite menu_mech_sprite;
// Fonts
sf::Font orbitron;
sf::Font exoplanetaria;
// Text Objects
sf::Text notice;
sf::Text keys;
sf::Text fps_counter;
sf::Text throttle_display;
sf::Text torso_display;
sf::Text input_text;
sf::Text mech_status;
sf::Text target_status;
sf::Text target_info;
void init(std::string cwd);
private:
void load_sound_buffers(std::string cwd);
void load_textures(std::string cwd);
void load_fonts(std::string cwd);
void init_sounds();
void init_sprites();
void init_text();
};
#endif // ASSETS_H

11
include/calc_helper.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef CALC_HELPER_H
#define CALC_HELPER_H
#include <SFML/Graphics.hpp>
float get_angle(sf::Vector2f v1, sf::Vector2f v2);
float get_distance(sf::Vector2f v1, sf::Vector2f v2);
sf::Vector2f get_midpoint(sf::Vector2f v1, sf::Vector2f v2);
std::vector<sf::Vector2f> x_sort(std::vector<sf::Vector2f> vectors, int total);
#endif // CALC_HELPER_H

10
include/cockpit.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef COCKPIT_H
#define COCKPIT_H
#include <assets.h>
#include <SFML/Graphics.hpp>
#include <player_controller.h>
void draw_cockpit(sf::RenderWindow &window, assets &resources, player_controller &pc, bool took_damage);
#endif // COCKPIT_H

42
include/entity.h Normal file
View File

@ -0,0 +1,42 @@
#ifndef ENTITY_H
#define ENTITY_H
#include <mech.h>
#include <assets.h>
#include <calc_helper.h>
#include <SFML/Graphics.hpp>
class entity
{
public:
float draw_x;
float draw_y;
float move_x;
float move_y;
float distance;
float old_pos;
float think_timer;
bool visible;
bool firing;
bool dying;
bool dead;
bool init;
int id;
int targeted_component;
sf::Sprite sprite;
sf::Sprite icon;
sf::Vector2f position;
std::string type;
std::string sub_type;
std::string components [7];
entity();
mech entity_mech;
void fire_weapons(assets &resources);
void update(sf::Vector2f camera_pos, bool maze);
private:
bool wall_blocking(sf::Vector2f camera_pos, bool maze);
void avoid_walls(bool maze);
};
#endif // ENTITY_H

11
include/file_handler.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef FILE_HANDLER_H
#define FILE_HANDLER_H
#include <iostream>
#include <sstream>
std::string get_file_contents(std::string file_path);
std::string write_to_file(std::string file_path, std::string data);
std::string append_file(std::string file_path, std::string data);
#endif

24
include/hud.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef HUD_H
#define HUD_H
#include <assets.h>
#include <entity.h>
#include <SFML/Graphics.hpp>
#include <player_controller.h>
class hud
{
public:
std::string notice;
bool show_notice;
float notice_timer;
void init(assets &resources);
void display_notice(sf::RenderWindow &window, std::string notice, float frame_time);
void draw_hud(sf::RenderWindow &window, float frame_time, int target_id, float speed, float torso_angle, mech &player_mech, mech &target_mech);
private:
assets resources;
void draw_mech(float x_pos, mech &mech_to_draw, sf::RenderWindow &window);
};
#endif // HUD_H

View File

@ -0,0 +1,56 @@
#ifndef INTERMISSION_MENU_H
#define INTERMISSION_MENU_H
#include <stdio.h>
#include <assets.h>
#include <market_menu.h>
#include <file_handler.h>
#include <settings_menu.h>
#include <SFML/Graphics.hpp>
#include <player_controller.h>
class intermission_menu
{
public:
intermission_menu();
market_menu market;
bool start_game;
bool return_to_main;
void init(std::string cwd, assets &resources);
bool draw_menu(sf::RenderWindow &window, player_controller &pc, float frame_time);
private:
assets resources;
settings_menu s_menu;
sf::Vector2i mouse_position;
sf::String input;
std::string cwd;
std::string notice;
std::string get_save_data(player_controller &pc);
std::vector<sf::VertexArray> saved_game_buttons;
std::vector<sf::VertexArray> delete_save_buttons;
std::vector<sf::Text> delete_save_labels;
std::vector<sf::Text> saved_game_labels;
int kp;
float notice_timer;
float spark_timer;
bool create_save_prompt_open;
bool save_prompt_open;
bool load_prompt_open;
bool repair_prompt_open;
bool show_notice;
bool prompt_displayed();
void create_save(player_controller &pc);
void save_game(player_controller &pc, int i);
void display_notice(sf::RenderWindow &window, std::string notice, float frame_time);
void reset_game(player_controller &pc);
void load_game(std::string cwd, std::string file, player_controller &pc);
void delete_save_game(int i);
void draw_saved_game_buttons(sf::RenderWindow &window);
void draw_delete_buttons(sf::RenderWindow &window);
void draw_save_menu(sf::RenderWindow &window);
void draw_load_menu(sf::RenderWindow &window);
void draw_repair_menu(sf::RenderWindow &window, player_controller &pc);
};
#endif // INTERMISSION_MENU_H

16
include/key_bindings.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef KEY_BINDINGS_H
#define KEY_BINDINGS_H
#include<file_handler.h>
#include<SFML/Graphics.hpp>
class key_bindings
{
public:
std::map<std::string, sf::Keyboard::Key> bindings;
void load(std::string cwd);
private:
std::map<std::string, sf::Keyboard::Key> keys;
};
#endif // KEY_BINDINGS_H

Some files were not shown because too many files have changed in this diff Show More