Compare commits
31
Commits
8a351b03b4
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
639b43e5c7 | ||
|
|
c6d22f9d8f | ||
|
|
6a69ea5685 | ||
|
|
3aee2fa468 | ||
|
|
0bfecbfb66 | ||
|
|
7beb263dfc | ||
|
|
420998231b | ||
|
|
fc4a95db3d | ||
|
|
331a0812bc | ||
|
|
888c0744d9 | ||
|
|
72a07395c7 | ||
|
|
ee934b2d26 | ||
|
|
b57c137daf | ||
|
|
5e8a530dba | ||
|
|
53d83a16fb | ||
|
|
d0fad7966a | ||
|
|
8659174a14 | ||
|
|
f0daf29917 | ||
|
|
5855b37c6e | ||
|
|
b7ad0fbb6c | ||
|
|
1673e995a6 | ||
|
|
f5b2925bdf | ||
|
|
2a29f0dceb | ||
|
|
7e7cbaf0e2 | ||
|
|
adca5dea55 | ||
|
|
bfcce7ce70 | ||
|
|
c602fda775 | ||
|
|
efa67b2189 | ||
|
|
d14c999cdf | ||
|
|
9aa0cfadd6 | ||
|
|
5974b9d325 |
No files matched your search
+13
-1
@@ -1,4 +1,16 @@
|
||||
main.d
|
||||
title.d
|
||||
obj/*
|
||||
Shot-Gun-Pete
|
||||
ShotGun-Pete
|
||||
banner.txt
|
||||
print.d
|
||||
intro.d
|
||||
sleep.d
|
||||
game.d
|
||||
chest.d
|
||||
door.d
|
||||
inventory.d
|
||||
player.d
|
||||
room.d
|
||||
wall.d
|
||||
item.d
|
||||
@@ -8,7 +8,7 @@ CXXFLAGS = -std=c++11 -Wall
|
||||
LDFLAGS =
|
||||
|
||||
# Makefile settings - Can be customized.
|
||||
APPNAME = Shot-Gun-Pete
|
||||
APPNAME = ShotGun-Pete
|
||||
EXT = .cpp
|
||||
SRCDIR = src
|
||||
OBJDIR = obj
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,13 @@
|
||||
[INTRO – Shotgun Pete]
|
||||
|
||||
The world didn’t end with a bang. It ended with a groan... and the scratching of dead fingers against steel shutters.
|
||||
|
||||
Pete used to sell shotguns, slugs, and survival tips to deer hunters and doomsday preppers out of his rundown gun store on the edge of town. Folks called him Shotgun Pete. They laughed at his bunker in the basement and his endless stockpile of beans and buckshot.
|
||||
|
||||
They’re not laughing now.
|
||||
|
||||
It’s been 47 days since the dead started walking. The city’s overrun. The power’s gone. The roads are broken and the rules are worse.
|
||||
|
||||
But Pete? Pete’s still here. Armed to the teeth. Ready to take back what’s his, one shell at a time.
|
||||
|
||||
Welcome to Shotgun Pete. Lock and load.
|
||||
Whitespace-only changes.
@@ -0,0 +1,27 @@
|
||||
#include "include/game.h"
|
||||
|
||||
void Game::gameloop(){
|
||||
//This is the main game loop.
|
||||
const int target_fps = 15;
|
||||
const std::chrono::duration<double> target_frame_duration = chrono::duration<double>(1.0 / target_fps);
|
||||
auto previous_time = std::chrono::steady_clock::now();
|
||||
|
||||
|
||||
while(true){
|
||||
auto current_time = std::chrono::steady_clock::now();
|
||||
chrono::duration<double> elapsed_time = current_time - previous_time;
|
||||
|
||||
// Game logic and rendering here
|
||||
system("clear");
|
||||
cout << "Frame time: " << elapsed_time.count() << " seconds" << endl;
|
||||
|
||||
if (elapsed_time < target_frame_duration) {
|
||||
chrono::duration<double> sleep_time = target_frame_duration - elapsed_time;
|
||||
this_thread::sleep_for(sleep_time);
|
||||
}
|
||||
|
||||
previous_time = chrono::steady_clock::now();
|
||||
exit(1);
|
||||
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,12 @@
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <cstdlib>
|
||||
using namespace std;
|
||||
|
||||
|
||||
class Game{
|
||||
public:
|
||||
void gameloop();
|
||||
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include "print.h"
|
||||
#include "sleep.h"
|
||||
using namespace std;
|
||||
|
||||
class Intro {
|
||||
public:
|
||||
static void mainIntro();
|
||||
};
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
|
||||
class Inventory{
|
||||
public:
|
||||
|
||||
Inventory(){
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
class Item{
|
||||
|
||||
|
||||
};
|
||||
@@ -1,2 +1,6 @@
|
||||
#include <iostream>
|
||||
#include "intro.h"
|
||||
#include "title.h"
|
||||
#include <cstdlib>
|
||||
#include "game.h"
|
||||
using namespace std;
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "inventory.h"
|
||||
#include "item.h"
|
||||
|
||||
|
||||
class Player{
|
||||
public:
|
||||
void move();
|
||||
void add_inventory(Item);
|
||||
bool check_inventory(Item);
|
||||
bool remove_inventory(Item);
|
||||
|
||||
private:
|
||||
Inventory inventory;
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
class Print{
|
||||
public:
|
||||
Print (){
|
||||
|
||||
};
|
||||
~Print(){
|
||||
|
||||
};
|
||||
static void printl(string text);
|
||||
static void println(string text);
|
||||
static void type(string text);
|
||||
static void blank_line();
|
||||
|
||||
};
|
||||
Whitespace-only changes.
@@ -0,0 +1,8 @@
|
||||
#include <chrono>
|
||||
using namespace std;
|
||||
|
||||
class Sleep{
|
||||
public:
|
||||
static void delay(int milliseconds);
|
||||
|
||||
};
|
||||
+2
-3
@@ -1,9 +1,8 @@
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
using namespace std;
|
||||
|
||||
class Title{
|
||||
private:
|
||||
protected:
|
||||
public:
|
||||
void mainTitle();
|
||||
static void mainTitle();
|
||||
};
|
||||
Whitespace-only changes.
@@ -0,0 +1,15 @@
|
||||
#include "include/intro.h"
|
||||
|
||||
void Intro::mainIntro(){
|
||||
Print::blank_line();
|
||||
Print::type("The world didn't end with a bang. It ended with a groan.. and the scratching of death fingers against ");
|
||||
Print::type("steel shutters.");
|
||||
Print::type("Pete used to sell shotguns, slugs, and survival tips to deer hunters and doomsday preppers out of his");
|
||||
Print::type("rundown gun store on the edge of town. Folks called him Shotgun Pete. They laughed at his bunker in the");
|
||||
Print::type("basement and his endless stockpile of beans and buckshot.");
|
||||
Print::type("They’re not laughing now.");
|
||||
Print::type("It’s been 47 days since the dead started walking. The city’s overrun. The power’s gone. The roads are broken");
|
||||
Print::type("and the rules are worse.");
|
||||
Print::type("But Pete? Pete’s still here. Armed to the teeth. Ready to take back what’s his, one shell at a time.");
|
||||
Print::type("Welcome to Shotgun Pete. Lock and load.");
|
||||
}
|
||||
Whitespace-only changes.
Whitespace-only changes.
+6
-3
@@ -1,8 +1,11 @@
|
||||
#include "include/main.h"
|
||||
#include "include/title.h"
|
||||
|
||||
int main (){
|
||||
Title title;
|
||||
title.mainTitle();
|
||||
system("clear");
|
||||
Title::mainTitle();
|
||||
Intro::mainIntro();
|
||||
//Game game;
|
||||
//game.gameloop();
|
||||
cin.get();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
#include "include/player.h"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#include "include/print.h"
|
||||
|
||||
void Print::printl(string text){
|
||||
cout << text << flush;
|
||||
}
|
||||
|
||||
void Print::println(string text){
|
||||
cout << text << endl;
|
||||
}
|
||||
|
||||
void Print::type(string text){
|
||||
int a = text.size();
|
||||
char* charArray = new char[a+1];
|
||||
strcpy(charArray, text.c_str());
|
||||
int i = 0;
|
||||
int time = 150;
|
||||
|
||||
while(i < a+1){
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(time));
|
||||
cout << charArray[i] << flush;
|
||||
i++;
|
||||
|
||||
}
|
||||
cout << endl;
|
||||
delete[] charArray;
|
||||
}
|
||||
|
||||
void Print::blank_line(){
|
||||
cout << endl;
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,10 @@
|
||||
#include "include/sleep.h"
|
||||
|
||||
void Sleep::delay(int milliseconds){
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
auto duration = std::chrono::milliseconds(milliseconds);
|
||||
|
||||
while (std::chrono::high_resolution_clock::now() - start < duration) {
|
||||
// Do nothing, just wait
|
||||
}
|
||||
}
|
||||
+15
-3
@@ -1,9 +1,21 @@
|
||||
#include "include/title.h"
|
||||
|
||||
#include "include/print.h"
|
||||
#include "include/sleep.h"
|
||||
|
||||
void Title::mainTitle(){
|
||||
|
||||
cout << "This is the title" << endl;
|
||||
int s = 900;
|
||||
Print::println("");
|
||||
Print::println("\033[31m███████╗██╗ ██╗ ██████╗ ████████╗ ██████╗ ██╗ ██╗███╗ ██╗ ██████╗ ███████╗████████╗███████╗");
|
||||
Sleep::delay(s);
|
||||
Print::println("██╔════╝██║ ██║██╔═══██╗╚══██╔══╝██╔════╝ ██║ ██║████╗ ██║ ██╔══██╗██╔════╝╚══██╔══╝██╔════╝");
|
||||
Sleep::delay(s);
|
||||
Print::println("███████╗███████║██║ ██║ ██║ ██║ ███╗██║ ██║██╔██╗ ██║ ██████╔╝█████╗ ██║ █████╗ ");
|
||||
Sleep::delay(s);
|
||||
Print::println("╚════██║██╔══██║██║ ██║ ██║ ██║ ██║██║ ██║██║╚██╗██║ ██╔═══╝ ██╔══╝ ██║ ██╔══╝ ");
|
||||
Sleep::delay(s);
|
||||
Print::println("███████║██║ ██║╚██████╔╝ ██║ ╚██████╔╝╚██████╔╝██║ ╚████║ ██║ ███████╗ ██║ ███████╗");
|
||||
Sleep::delay(s);
|
||||
Print::println("╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝ ╚═╝ ╚══════╝");
|
||||
}
|
||||
|
||||
|
||||
Whitespace-only changes.
Reference in new issue
Block a user