Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
32e50969b4 Who knows 2025-09-26 09:26:47 -06:00
45 changed files with 38346 additions and 38306 deletions

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
.idea
.idea
cmake-build-debug/

38
Beam.h
View file

@ -1,19 +1,19 @@
//
// Created by Benjamin on 4/23/2021.
//
#ifndef SFML_TEMPLATE_BEAM_H
#define SFML_TEMPLATE_BEAM_H
class Beam : public Shootable {
public:
Beam(const sf::Texture& texture, const sf::IntRect &rect, double scale, int rows, int cols, int xOffset, int yOffset, int frameDelay, double damage, double _range) : Shootable(texture, rect, scale, rows, cols, xOffset, yOffset, frameDelay, damage) {
lifetime = 1;
range = _range;
}
};
#endif //SFML_TEMPLATE_BEAM_H
//
// Created by Benjamin on 4/23/2021.
//
#ifndef SFML_TEMPLATE_BEAM_H
#define SFML_TEMPLATE_BEAM_H
class Beam : public Shootable {
public:
Beam(const sf::Texture& texture, const sf::IntRect &rect, double scale, int rows, int cols, int xOffset, int yOffset, int frameDelay, double damage, double _range) : Shootable(texture, rect, scale, rows, cols, xOffset, yOffset, frameDelay, damage) {
lifetime = 1;
range = _range;
}
};
#endif //SFML_TEMPLATE_BEAM_H

View file

@ -1,46 +1,46 @@
//
// Created by Benjamin on 4/23/2021.
//
#ifndef SFML_TEMPLATE_BEAMWEAPON_H
#define SFML_TEMPLATE_BEAMWEAPON_H
#include <thread>
#include "Beam.h"
class BeamWeapon : public Weapon {
private:
int duration;
int framesShot = 0;
public:
BeamWeapon(Beam _proj, const sf::SoundBuffer& buffer, float volume, double effectiveAngle, int _duration, int frameDelay) : Weapon(frameDelay, effectiveAngle, buffer, volume) {
projectile = std::move(_proj);
duration = _duration;
}
Shootable* shoot(const Ship* shooter) override {
framesShot++;
if (noise.getStatus() != sf::Sound::Playing) noise.play();
projectile.setShooter((GameSprite *) shooter);
sf::Vector2f adjusted(shooter->getXPos() + shooter->getLocalBounds().width/4 * shooter->getScale().x * cos(shooter->getDirection()*GameSprite::PI/180), shooter->getYPos() - shooter->getLocalBounds().width/4 * shooter->getScale().x * sin(shooter->getDirection()*GameSprite::PI/180));
double newWidth = shooter->getTarget() == nullptr ? projectile.getRange() : GameSprite::distance(adjusted, shooter->getTarget()->getPosition());
projectile.setTextureRect(sf::IntRect(projectile.getTextureRect().left, projectile.getTextureRect().top, newWidth > projectile.getRange() ? projectile.getRange() * (1/projectile.getScale().x) : newWidth * (1/projectile.getScale().x), projectile.getTextureRect().height));
projectile.setOrigin(0, projectile.getLocalBounds().height/2);
projectile.setPosition(adjusted);
projectile.setDirection(shooter->getTarget() == nullptr ? shooter->getDirection() : -GameSprite::getAimAngle(shooter->getTarget()->getPosition(), projectile.getPosition()));
if (framesShot == duration) {
framesShot = 0;
currentFrame = 0;
noise.stop();
}
return new Shootable(projectile);
}
};
#endif //SFML_TEMPLATE_BEAMWEAPON_H
//
// Created by Benjamin on 4/23/2021.
//
#ifndef SFML_TEMPLATE_BEAMWEAPON_H
#define SFML_TEMPLATE_BEAMWEAPON_H
#include <thread>
#include "Beam.h"
class BeamWeapon : public Weapon {
private:
int duration;
int framesShot = 0;
public:
BeamWeapon(Beam _proj, const sf::SoundBuffer& buffer, float volume, double effectiveAngle, int _duration, int frameDelay) : Weapon(frameDelay, effectiveAngle, buffer, volume) {
projectile = std::move(_proj);
duration = _duration;
}
Shootable* shoot(const Ship* shooter) override {
framesShot++;
if (noise.getStatus() != sf::Sound::Playing) noise.play();
projectile.setShooter((GameSprite *) shooter);
sf::Vector2f adjusted(shooter->getXPos() + shooter->getLocalBounds().width/4 * shooter->getScale().x * cos(shooter->getDirection()*GameSprite::PI/180), shooter->getYPos() - shooter->getLocalBounds().width/4 * shooter->getScale().x * sin(shooter->getDirection()*GameSprite::PI/180));
double newWidth = shooter->getTarget() == nullptr ? projectile.getRange() : GameSprite::distance(adjusted, shooter->getTarget()->getPosition());
projectile.setTextureRect(sf::IntRect(projectile.getTextureRect().left, projectile.getTextureRect().top, newWidth > projectile.getRange() ? projectile.getRange() * (1/projectile.getScale().x) : newWidth * (1/projectile.getScale().x), projectile.getTextureRect().height));
projectile.setOrigin(0, projectile.getLocalBounds().height/2);
projectile.setPosition(adjusted);
projectile.setDirection(shooter->getTarget() == nullptr ? shooter->getDirection() : -GameSprite::getAimAngle(shooter->getTarget()->getPosition(), projectile.getPosition()));
if (framesShot == duration) {
framesShot = 0;
currentFrame = 0;
noise.stop();
}
return new Shootable(projectile);
}
};
#endif //SFML_TEMPLATE_BEAMWEAPON_H

View file

@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 14)
include_directories("D:/Program Files/mingw-w64/mingw64/x86_64-w64-mingw32/include")
add_executable(SFML_Template main.cpp Game.cpp Game.h GameSprite.cpp GameSprite.h Ship.cpp Ship.h System.cpp System.h Planet.cpp Planet.h Collision.cpp Collision.h Menu.cpp Menu.h GameSound.h)
add_executable(SFML_Template main.cpp Game.cpp Game.h GameSprite.cpp GameSprite.h Ship.cpp Ship.h System.cpp System.h Planet.cpp Planet.h Collision.cpp Collision.h Menu.cpp Menu.h Rider.h)
target_link_directories(SFML_Template PUBLIC "D:/Program Files/mingw-w64/mingw64/x86_64-w64-mingw32/lib")

358
COMShip.h
View file

@ -1,179 +1,179 @@
//
// Created by benmo on 3/26/2020.
//
#ifndef SFML_TEMPLATE_COMSHIP_H
#define SFML_TEMPLATE_COMSHIP_H
#include <random>
#include <iostream>
#include "System.h"
#include "Ship.h"
#include <float.h>
class COMShip : public Ship {
public:
enum Status {
ROLL, MOVING, WARPING, ATTACKING
};
private:
sf::Vector2f destination;
int ticksSinceLast = 0, landing = -9999;
float targetVelo;
std::string name;
int playerReputation;
Status status = ROLL;
public:
COMShip(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float accelRate, float maxVelocity, float direction, float turnRate, int maxFuel, int maxHull, int cargo, int passengers, std::string _name, int playerRep) : Ship(texture, scale, xPos, yPos, velocity, maxVelocity, direction, turnRate, maxFuel, maxHull, cargo, passengers) {
destination = sf::Vector2f(xPos + 1, yPos + 1);
spritePhysics.acceleration = accelRate;
playerReputation = playerRep;
name = std::move(_name);
};
void shoot(std::vector<Shootable*> &shots) override {
for (Weapon *w : weapons) {
double angle = -getAimAngle(target->getPosition(), getPosition());
double leftEffectiveBorder = spritePhysics.direction + w->getEffectiveAngle()/2;
double rightEffectiveBorder = spritePhysics.direction - w->getEffectiveAngle()/2;
if (w->canShoot() && ( angle < leftEffectiveBorder && angle > rightEffectiveBorder) && distance(target->getPosition(), getPosition()) < w->getProjectile().getRange()) {
shots.push_back(w->shoot(this));
}
}
}
template< class RNG >
Status pathfind(const sf::RenderWindow &window, RNG &gen, System *loc, Ship* player, std::vector<Shootable*> &projectiles) {
if (status != ATTACKING && isHostile()) {
setTarget(player);
status = ATTACKING;
}
if (status == ROLL) {
rollPosition(window, gen);
}
if (status == ATTACKING) {
if (target != nullptr) {
dogFight(getShortestWeaponRange(), target, projectiles);
} else {
status = MOVING;
}
}
if (status == MOVING) {
approachTargetVelocity();
turnTowardsTarget();
ticksSinceLast++;
if (ticksSinceLast > 2000) std::cout << "likely loop" << std::endl;
if (distance(destination, getPosition()) > 4000) std::cout << "Out of bounds" << std::endl;
else if (distance(destination, getPosition()) <(180 * targetVelo) / (GameSprite::PI * getTurnRate()) * 1.1)
status = ROLL;
}
return status;
}
void dogFight(double dist, Ship *target, std::vector<Shootable*> &projectiles) {
destination = target->getPosition();
if (distance(getPosition(), target->getPosition()) > dist) targetVelo = spritePhysics.maxVelocity;
else targetVelo = target->getVelocity();
turnTowardsTarget();
approachTargetVelocity();
shoot(projectiles);
}
double getShortestWeaponRange() {
double smallest = DBL_MAX;
for (Weapon *w : weapons) {
if (w->getProjectile().getRange() < smallest) {
smallest = w->getProjectile().getRange() == 0 ? smallest : w->getProjectile().getRange();
}
}
return smallest == DBL_MAX ? -1 : smallest;
}
void turnTowardsTarget() {
double targetAngle = -getAimAngle(destination, getPosition());
double changeAngle = abs(spritePhysics.direction - targetAngle);
if (changeAngle > 180) changeAngle = abs(changeAngle - 360);
if (changeAngle > getTurnRate()) changeAngle = getTurnRate();
if (abs(spritePhysics.direction - targetAngle) <= 180) turn(spritePhysics.direction - targetAngle > 0 ? changeAngle : -changeAngle);
else turn(spritePhysics.direction - targetAngle > 0 ? -changeAngle : changeAngle);
}
void approachTargetVelocity() {
if (getVelocity() > targetVelo) accelerate(
abs(spritePhysics.velocity - targetVelo) > spritePhysics.acceleration ? -spritePhysics.acceleration : -abs(
spritePhysics.velocity - targetVelo));
else if (getVelocity() < targetVelo) accelerate(
abs(spritePhysics.velocity - targetVelo) > spritePhysics.acceleration ? spritePhysics.acceleration : abs(
spritePhysics.velocity - targetVelo));
}
template<class RNG>
void rollPosition(const sf::RenderWindow &window, RNG &gen) {
std::uniform_int_distribution<int> roll;
roll = std::uniform_int_distribution<int>(0, 100);
if (roll(gen) == 50) {
status = WARPING;
return;
}
else status = MOVING;
roll = std::uniform_int_distribution<int>(-1500, 1500);
do {
int randXPos = roll(gen);
int randYPos = roll(gen);
destination = sf::Vector2f((int) window.getSize().x / 2.0 + randXPos,
(int) window.getSize().y / 2.0 + randYPos);
roll = std::uniform_int_distribution<int>(4, 6);
targetVelo = spritePhysics.maxVelocity / roll(gen);
} while (distance(destination, getPosition()) < (180 * targetVelo) / (PI * getTurnRate()) * 1.1);
ticksSinceLast = 0;
}
int getPlayerRep() const {
return playerReputation;
}
void setPlayerRep(int playerRep) {
playerReputation = playerRep;
}
bool isFriendly() const {
return playerReputation >= Game::FRIENDLY_LOW;
}
bool isNeutral() const {
return playerReputation >= Game::NUETRAL_LOW && playerReputation <= Game::NUETRAL_HIGH;
}
bool isHostile() const {
return playerReputation <= Game::HOSTILE_HIGH;
}
std::string getName() {
return name;
}
};
#endif //SFML_TEMPLATE_COMSHIP_H
//
// Created by benmo on 3/26/2020.
//
#ifndef SFML_TEMPLATE_COMSHIP_H
#define SFML_TEMPLATE_COMSHIP_H
#include <random>
#include <iostream>
#include "System.h"
#include "Ship.h"
#include <float.h>
class COMShip : public Ship {
public:
enum Status {
ROLL, MOVING, WARPING, ATTACKING
};
private:
sf::Vector2f destination;
int ticksSinceLast = 0, landing = -9999;
float targetVelo;
std::string name;
int playerReputation;
Status status = ROLL;
public:
COMShip(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float accelRate, float maxVelocity, float direction, float turnRate, int maxFuel, int maxHull, int cargo, int passengers, std::string _name, int playerRep) : Ship(texture, scale, xPos, yPos, velocity, maxVelocity, direction, turnRate, maxFuel, maxHull, cargo, passengers) {
destination = sf::Vector2f(xPos + 1, yPos + 1);
spritePhysics.acceleration = accelRate;
playerReputation = playerRep;
name = std::move(_name);
};
void shoot(std::vector<Shootable*> &shots) override {
for (Weapon *w : weapons) {
double angle = -getAimAngle(target->getPosition(), getPosition());
double leftEffectiveBorder = spritePhysics.direction + w->getEffectiveAngle()/2;
double rightEffectiveBorder = spritePhysics.direction - w->getEffectiveAngle()/2;
if (w->canShoot() && ( angle < leftEffectiveBorder && angle > rightEffectiveBorder) && distance(target->getPosition(), getPosition()) < w->getProjectile().getRange()) {
shots.push_back(w->shoot(this));
}
}
}
template< class RNG >
Status pathfind(const sf::RenderWindow &window, RNG &gen, System *loc, Ship* player, std::vector<Shootable*> &projectiles) {
if (status != ATTACKING && isHostile()) {
setTarget(player);
status = ATTACKING;
}
if (status == ROLL) {
rollPosition(window, gen);
}
if (status == ATTACKING) {
if (target != nullptr) {
dogFight(getShortestWeaponRange(), target, projectiles);
} else {
status = MOVING;
}
}
if (status == MOVING) {
approachTargetVelocity();
turnTowardsTarget();
ticksSinceLast++;
if (ticksSinceLast > 2000) std::cout << "likely loop" << std::endl;
if (distance(destination, getPosition()) > 4000) std::cout << "Out of bounds" << std::endl;
else if (distance(destination, getPosition()) <(180 * targetVelo) / (GameSprite::PI * getTurnRate()) * 1.1)
status = ROLL;
}
return status;
}
void dogFight(double dist, Ship *target, std::vector<Shootable*> &projectiles) {
destination = target->getPosition();
if (distance(getPosition(), target->getPosition()) > dist) targetVelo = spritePhysics.maxVelocity;
else targetVelo = target->getVelocity();
turnTowardsTarget();
approachTargetVelocity();
shoot(projectiles);
}
double getShortestWeaponRange() {
double smallest = DBL_MAX;
for (Weapon *w : weapons) {
if (w->getProjectile().getRange() < smallest) {
smallest = w->getProjectile().getRange() == 0 ? smallest : w->getProjectile().getRange();
}
}
return smallest == DBL_MAX ? -1 : smallest;
}
void turnTowardsTarget() {
double targetAngle = -getAimAngle(destination, getPosition());
double changeAngle = abs(spritePhysics.direction - targetAngle);
if (changeAngle > 180) changeAngle = abs(changeAngle - 360);
if (changeAngle > getTurnRate()) changeAngle = getTurnRate();
if (abs(spritePhysics.direction - targetAngle) <= 180) turn(spritePhysics.direction - targetAngle > 0 ? changeAngle : -changeAngle);
else turn(spritePhysics.direction - targetAngle > 0 ? -changeAngle : changeAngle);
}
void approachTargetVelocity() {
if (getVelocity() > targetVelo) accelerate(
abs(spritePhysics.velocity - targetVelo) > spritePhysics.acceleration ? -spritePhysics.acceleration : -abs(
spritePhysics.velocity - targetVelo));
else if (getVelocity() < targetVelo) accelerate(
abs(spritePhysics.velocity - targetVelo) > spritePhysics.acceleration ? spritePhysics.acceleration : abs(
spritePhysics.velocity - targetVelo));
}
template<class RNG>
void rollPosition(const sf::RenderWindow &window, RNG &gen) {
std::uniform_int_distribution<int> roll;
roll = std::uniform_int_distribution<int>(0, 100);
if (roll(gen) == 50) {
status = WARPING;
return;
}
else status = MOVING;
roll = std::uniform_int_distribution<int>(-1500, 1500);
do {
int randXPos = roll(gen);
int randYPos = roll(gen);
destination = sf::Vector2f((int) window.getSize().x / 2.0 + randXPos,
(int) window.getSize().y / 2.0 + randYPos);
roll = std::uniform_int_distribution<int>(4, 6);
targetVelo = spritePhysics.maxVelocity / roll(gen);
} while (distance(destination, getPosition()) < (180 * targetVelo) / (PI * getTurnRate()) * 1.1);
ticksSinceLast = 0;
}
int getPlayerRep() const {
return playerReputation;
}
void setPlayerRep(int playerRep) {
playerReputation = playerRep;
}
bool isFriendly() const {
return playerReputation >= Game::FRIENDLY_LOW;
}
bool isNeutral() const {
return playerReputation >= Game::NUETRAL_LOW && playerReputation <= Game::NUETRAL_HIGH;
}
bool isHostile() const {
return playerReputation <= Game::HOSTILE_HIGH;
}
std::string getName() {
return name;
}
};
#endif //SFML_TEMPLATE_COMSHIP_H

View file

@ -1,190 +1,191 @@
/*
* File: collision.cpp
* Author: Nick (original version), ahnonay (SFML2 compatibility)
*/
#include <map>
#include "Collision.h"
namespace Collision
{
class BitmaskManager
{
public:
~BitmaskManager() {
std::map<const sf::Texture*, sf::Uint8*>::const_iterator end = Bitmasks.end();
for (std::map<const sf::Texture*, sf::Uint8*>::const_iterator iter = Bitmasks.begin(); iter!=end; iter++)
delete [] iter->second;
}
sf::Uint8 GetPixel (const sf::Uint8* mask, const sf::Texture* tex, unsigned int x, unsigned int y) {
if (x>tex->getSize().x||y>tex->getSize().y)
return 0;
return mask[x+y*tex->getSize().x];
}
sf::Uint8* GetMask (const sf::Texture* tex) {
sf::Uint8* mask;
std::map<const sf::Texture*, sf::Uint8*>::iterator pair = Bitmasks.find(tex);
if (pair==Bitmasks.end())
{
sf::Image img = tex->copyToImage();
mask = CreateMask (tex, img);
}
else
mask = pair->second;
return mask;
}
sf::Uint8* CreateMask (const sf::Texture* tex, const sf::Image& img) {
sf::Uint8* mask = new sf::Uint8[tex->getSize().y*tex->getSize().x];
for (unsigned int y = 0; y<tex->getSize().y; y++)
{
for (unsigned int x = 0; x<tex->getSize().x; x++)
mask[x+y*tex->getSize().x] = img.getPixel(x,y).a;
}
Bitmasks.insert(std::pair<const sf::Texture*, sf::Uint8*>(tex,mask));
return mask;
}
private:
std::map<const sf::Texture*, sf::Uint8*> Bitmasks;
};
BitmaskManager Bitmasks;
bool PixelPerfectTest(const sf::Sprite& Object1, const sf::Sprite& Object2, sf::Uint8 AlphaLimit) {
sf::FloatRect Intersection;
if (Object1.getGlobalBounds().intersects(Object2.getGlobalBounds(), Intersection)) {
sf::IntRect O1SubRect = Object1.getTextureRect();
sf::IntRect O2SubRect = Object2.getTextureRect();
sf::Uint8* mask1 = Bitmasks.GetMask(Object1.getTexture());
sf::Uint8* mask2 = Bitmasks.GetMask(Object2.getTexture());
// Loop through our pixels
for (int i = Intersection.left; i < Intersection.left+Intersection.width; i++) {
for (int j = Intersection.top; j < Intersection.top+Intersection.height; j++) {
sf::Vector2f o1v = Object1.getInverseTransform().transformPoint(i, j);
sf::Vector2f o2v = Object2.getInverseTransform().transformPoint(i, j);
// Make sure pixels fall within the sprite's subrect
if (o1v.x > 0 && o1v.y > 0 && o2v.x > 0 && o2v.y > 0 &&
o1v.x < O1SubRect.width && o1v.y < O1SubRect.height &&
o2v.x < O2SubRect.width && o2v.y < O2SubRect.height) {
if (Bitmasks.GetPixel(mask1, Object1.getTexture(), (int)(o1v.x)+O1SubRect.left, (int)(o1v.y)+O1SubRect.top) > AlphaLimit &&
Bitmasks.GetPixel(mask2, Object2.getTexture(), (int)(o2v.x)+O2SubRect.left, (int)(o2v.y)+O2SubRect.top) > AlphaLimit)
return true;
}
}
}
}
return false;
}
bool CreateTextureAndBitmask(sf::Texture &LoadInto, const std::string& Filename)
{
sf::Image img;
if (!img.loadFromFile(Filename))
return false;
if (!LoadInto.loadFromImage(img))
return false;
Bitmasks.CreateMask(&LoadInto, img);
return true;
}
sf::Vector2f GetSpriteCenter (const sf::Sprite& Object)
{
sf::FloatRect AABB = Object.getGlobalBounds();
return sf::Vector2f (AABB.left+AABB.width/2.f, AABB.top+AABB.height/2.f);
}
sf::Vector2f GetSpriteSize (const sf::Sprite& Object)
{
sf::IntRect OriginalSize = Object.getTextureRect();
sf::Vector2f Scale = Object.getScale();
return sf::Vector2f (OriginalSize.width*Scale.x, OriginalSize.height*Scale.y);
}
bool CircleTest(const sf::Sprite& Object1, const sf::Sprite& Object2) {
sf::Vector2f Obj1Size = GetSpriteSize(Object1);
sf::Vector2f Obj2Size = GetSpriteSize(Object2);
float Radius1 = (Obj1Size.x + Obj1Size.y) / 4;
float Radius2 = (Obj2Size.x + Obj2Size.y) / 4;
sf::Vector2f Distance = GetSpriteCenter(Object1)-GetSpriteCenter(Object2);
return (Distance.x * Distance.x + Distance.y * Distance.y <= (Radius1 + Radius2) * (Radius1 + Radius2));
}
class OrientedBoundingBox // Used in the BoundingBoxTest
{
public:
OrientedBoundingBox (const sf::Sprite& Object) // Calculate the four points of the OBB from a transformed (scaled, rotated...) sprite
{
sf::Transform trans = Object.getTransform();
sf::IntRect local = Object.getTextureRect();
Points[0] = trans.transformPoint(0.f, 0.f);
Points[1] = trans.transformPoint(local.width, 0.f);
Points[2] = trans.transformPoint(local.width, local.height);
Points[3] = trans.transformPoint(0.f, local.height);
}
sf::Vector2f Points[4];
void ProjectOntoAxis (const sf::Vector2f& Axis, float& Min, float& Max) // Project all four points of the OBB onto the given axis and return the dotproducts of the two outermost points
{
Min = (Points[0].x*Axis.x+Points[0].y*Axis.y);
Max = Min;
for (int j = 1; j<4; j++)
{
float Projection = (Points[j].x*Axis.x+Points[j].y*Axis.y);
if (Projection<Min)
Min=Projection;
if (Projection>Max)
Max=Projection;
}
}
};
bool BoundingBoxTest(const sf::Sprite& Object1, const sf::Sprite& Object2) {
OrientedBoundingBox OBB1 (Object1);
OrientedBoundingBox OBB2 (Object2);
// Create the four distinct axes that are perpendicular to the edges of the two rectangles
sf::Vector2f Axes[4] = {
sf::Vector2f (OBB1.Points[1].x-OBB1.Points[0].x,
OBB1.Points[1].y-OBB1.Points[0].y),
sf::Vector2f (OBB1.Points[1].x-OBB1.Points[2].x,
OBB1.Points[1].y-OBB1.Points[2].y),
sf::Vector2f (OBB2.Points[0].x-OBB2.Points[3].x,
OBB2.Points[0].y-OBB2.Points[3].y),
sf::Vector2f (OBB2.Points[0].x-OBB2.Points[1].x,
OBB2.Points[0].y-OBB2.Points[1].y)
};
for (int i = 0; i<4; i++) // For each axis...
{
float MinOBB1, MaxOBB1, MinOBB2, MaxOBB2;
// ... project the points of both OBBs onto the axis ...
OBB1.ProjectOntoAxis(Axes[i], MinOBB1, MaxOBB1);
OBB2.ProjectOntoAxis(Axes[i], MinOBB2, MaxOBB2);
// ... and check whether the outermost projected points of both OBBs overlap.
// If this is not the case, the Separating Axis Theorem states that there can be no collision between the rectangles
if (!((MinOBB2<=MaxOBB1)&&(MaxOBB2>=MinOBB1)))
return false;
}
return true;
}
/*
* File: collision.cpp
* Author: Nick (original version), ahnonay (SFML2 compatibility), bmorgan1 (collsion point return)
*/
#include <map>
#include "Collision.h"
namespace Collision
{
class BitmaskManager
{
public:
~BitmaskManager() {
std::map<const sf::Texture*, sf::Uint8*>::const_iterator end = Bitmasks.end();
for (std::map<const sf::Texture*, sf::Uint8*>::const_iterator iter = Bitmasks.begin(); iter!=end; iter++)
delete [] iter->second;
}
sf::Uint8 GetPixel (const sf::Uint8* mask, const sf::Texture* tex, unsigned int x, unsigned int y) {
if (x>tex->getSize().x||y>tex->getSize().y)
return 0;
return mask[x+y*tex->getSize().x];
}
sf::Uint8* GetMask (const sf::Texture* tex) {
sf::Uint8* mask;
std::map<const sf::Texture*, sf::Uint8*>::iterator pair = Bitmasks.find(tex);
if (pair==Bitmasks.end())
{
sf::Image img = tex->copyToImage();
mask = CreateMask (tex, img);
}
else
mask = pair->second;
return mask;
}
sf::Uint8* CreateMask (const sf::Texture* tex, const sf::Image& img) {
sf::Uint8* mask = new sf::Uint8[tex->getSize().y*tex->getSize().x];
for (unsigned int y = 0; y<tex->getSize().y; y++)
{
for (unsigned int x = 0; x<tex->getSize().x; x++)
mask[x+y*tex->getSize().x] = img.getPixel(x,y).a;
}
Bitmasks.insert(std::pair<const sf::Texture*, sf::Uint8*>(tex,mask));
return mask;
}
private:
std::map<const sf::Texture*, sf::Uint8*> Bitmasks;
};
BitmaskManager Bitmasks;
bool PixelPerfectTest(const sf::Sprite& Object1, const sf::Sprite& Object2, sf::Uint8 AlphaLimit, sf::Vector2f &point) {
sf::FloatRect Intersection;
if (Object1.getGlobalBounds().intersects(Object2.getGlobalBounds(), Intersection)) {
sf::IntRect O1SubRect = Object1.getTextureRect();
sf::IntRect O2SubRect = Object2.getTextureRect();
sf::Uint8* mask1 = Bitmasks.GetMask(Object1.getTexture());
sf::Uint8* mask2 = Bitmasks.GetMask(Object2.getTexture());
// Loop through our pixels
for (int i = Intersection.left; i < Intersection.left+Intersection.width; i++) {
for (int j = Intersection.top; j < Intersection.top+Intersection.height; j++) {
sf::Vector2f o1v = Object1.getInverseTransform().transformPoint(i, j);
sf::Vector2f o2v = Object2.getInverseTransform().transformPoint(i, j);
// Make sure pixels fall within the sprite's subrect
if (o1v.x > 0 && o1v.y > 0 && o2v.x > 0 && o2v.y > 0 &&
o1v.x < O1SubRect.width && o1v.y < O1SubRect.height &&
o2v.x < O2SubRect.width && o2v.y < O2SubRect.height) {
if (Bitmasks.GetPixel(mask1, Object1.getTexture(), (int)(o1v.x)+O1SubRect.left, (int)(o1v.y)+O1SubRect.top) > AlphaLimit &&
Bitmasks.GetPixel(mask2, Object2.getTexture(), (int)(o2v.x)+O2SubRect.left, (int)(o2v.y)+O2SubRect.top) > AlphaLimit) {
point = sf::Vector2f(i, j);
return true;
}
}
}
}
}
return false;
}
bool CreateTextureAndBitmask(sf::Texture &LoadInto, const std::string& Filename)
{
sf::Image img;
if (!img.loadFromFile(Filename))
return false;
if (!LoadInto.loadFromImage(img))
return false;
Bitmasks.CreateMask(&LoadInto, img);
return true;
}
sf::Vector2f GetSpriteCenter (const sf::Sprite& Object)
{
sf::FloatRect AABB = Object.getGlobalBounds();
return sf::Vector2f (AABB.left+AABB.width/2.f, AABB.top+AABB.height/2.f);
}
sf::Vector2f GetSpriteSize (const sf::Sprite& Object)
{
sf::IntRect OriginalSize = Object.getTextureRect();
sf::Vector2f Scale = Object.getScale();
return sf::Vector2f (OriginalSize.width*Scale.x, OriginalSize.height*Scale.y);
}
bool CircleTest(const sf::Sprite& Object1, const sf::Sprite& Object2) {
sf::Vector2f Obj1Size = GetSpriteSize(Object1);
sf::Vector2f Obj2Size = GetSpriteSize(Object2);
float Radius1 = (Obj1Size.x + Obj1Size.y) / 4;
float Radius2 = (Obj2Size.x + Obj2Size.y) / 4;
sf::Vector2f Distance = GetSpriteCenter(Object1)-GetSpriteCenter(Object2);
return (Distance.x * Distance.x + Distance.y * Distance.y <= (Radius1 + Radius2) * (Radius1 + Radius2));
}
class OrientedBoundingBox // Used in the BoundingBoxTest
{
public:
OrientedBoundingBox (const sf::Sprite& Object) // Calculate the four points of the OBB from a transformed (scaled, rotated...) sprite
{
sf::Transform trans = Object.getTransform();
sf::IntRect local = Object.getTextureRect();
Points[0] = trans.transformPoint(0.f, 0.f);
Points[1] = trans.transformPoint(local.width, 0.f);
Points[2] = trans.transformPoint(local.width, local.height);
Points[3] = trans.transformPoint(0.f, local.height);
}
sf::Vector2f Points[4];
void ProjectOntoAxis (const sf::Vector2f& Axis, float& Min, float& Max) // Project all four points of the OBB onto the given axis and return the dotproducts of the two outermost points
{
Min = (Points[0].x*Axis.x+Points[0].y*Axis.y);
Max = Min;
for (int j = 1; j<4; j++)
{
float Projection = (Points[j].x*Axis.x+Points[j].y*Axis.y);
if (Projection<Min)
Min=Projection;
if (Projection>Max)
Max=Projection;
}
}
};
bool BoundingBoxTest(const sf::Sprite& Object1, const sf::Sprite& Object2) {
OrientedBoundingBox OBB1 (Object1);
OrientedBoundingBox OBB2 (Object2);
// Create the four distinct axes that are perpendicular to the edges of the two rectangles
sf::Vector2f Axes[4] = {
sf::Vector2f (OBB1.Points[1].x-OBB1.Points[0].x,
OBB1.Points[1].y-OBB1.Points[0].y),
sf::Vector2f (OBB1.Points[1].x-OBB1.Points[2].x,
OBB1.Points[1].y-OBB1.Points[2].y),
sf::Vector2f (OBB2.Points[0].x-OBB2.Points[3].x,
OBB2.Points[0].y-OBB2.Points[3].y),
sf::Vector2f (OBB2.Points[0].x-OBB2.Points[1].x,
OBB2.Points[0].y-OBB2.Points[1].y)
};
for (int i = 0; i<4; i++) // For each axis...
{
float MinOBB1, MaxOBB1, MinOBB2, MaxOBB2;
// ... project the points of both OBBs onto the axis ...
OBB1.ProjectOntoAxis(Axes[i], MinOBB1, MaxOBB1);
OBB2.ProjectOntoAxis(Axes[i], MinOBB2, MaxOBB2);
// ... and check whether the outermost projected points of both OBBs overlap.
// If this is not the case, the Separating Axis Theorem states that there can be no collision between the rectangles
if (!((MinOBB2<=MaxOBB1)&&(MaxOBB2>=MinOBB1)))
return false;
}
return true;
}
}

View file

@ -1,77 +1,77 @@
/*
* File: collision.h
* Authors: Nick Koirala (original version), ahnonay (SFML2 compatibility)
*
* Collision Detection and handling class
* For SFML2.
Notice from the original version:
(c) 2009 - LittleMonkey Ltd
This software is provided 'as-is', without any express or
implied warranty. In no event will the authors be held
liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but
is not required.
2. Altered source versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any
source distribution.
*
* Created on 30 January 2009, 11:02
*/
#ifndef SFML_TEMPLATE_COLLISION_H
#define SFML_TEMPLATE_COLLISION_H
#include <SFML\Graphics.hpp>
namespace Collision {
//////
/// Test for a collision between two sprites by comparing the alpha values of overlapping pixels
/// Supports scaling and rotation
/// AlphaLimit: The threshold at which a pixel becomes "solid". If AlphaLimit is 127, a pixel with
/// alpha value 128 will cause a collision and a pixel with alpha value 126 will not.
///
/// This functions creates bitmasks of the textures of the two sprites by
/// downloading the textures from the graphics card to memory -> SLOW!
/// You can avoid this by using the "CreateTextureAndBitmask" function
//////
bool PixelPerfectTest(const sf::Sprite& Object1 ,const sf::Sprite& Object2, sf::Uint8 AlphaLimit = 0);
//////
/// Replaces Texture::loadFromFile
/// Load an imagefile into the given texture and create a bitmask for it
/// This is much faster than creating the bitmask for a texture on the first run of "PixelPerfectTest"
///
/// The function returns false if the file could not be opened for some reason
//////
bool CreateTextureAndBitmask(sf::Texture &LoadInto, const std::string& Filename);
//////
/// Test for collision using circle collision dection
/// Radius is averaged from the dimensions of the sprite so
/// roughly circular objects will be much more accurate
//////
bool CircleTest(const sf::Sprite& Object1, const sf::Sprite& Object2);
//////
/// Test for bounding box collision using the Separating Axis Theorem
/// Supports scaling and rotation
//////
bool BoundingBoxTest(const sf::Sprite& Object1, const sf::Sprite& Object2);
}
#endif //SFML_TEMPLATE_COLLISION_H
/*
* File: collision.h
* Authors: Nick Koirala (original version), ahnonay (SFML2 compatibility), bmorgan1 (collsion point return)
*
* Collision Detection and handling class
* For SFML2.
Notice from the original version:
(c) 2009 - LittleMonkey Ltd
This software is provided 'as-is', without any express or
implied warranty. In no event will the authors be held
liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but
is not required.
2. Altered source versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any
source distribution.
*
* Created on 30 January 2009, 11:02
*/
#ifndef SFML_TEMPLATE_COLLISION_H
#define SFML_TEMPLATE_COLLISION_H
#include <SFML\Graphics.hpp>
namespace Collision {
//////
/// Test for a collision between two sprites by comparing the alpha values of overlapping pixels
/// Supports scaling and rotation
/// AlphaLimit: The threshold at which a pixel becomes "solid". If AlphaLimit is 127, a pixel with
/// alpha value 128 will cause a collision and a pixel with alpha value 126 will not.
///
/// This functions creates bitmasks of the textures of the two sprites by
/// downloading the textures from the graphics card to memory -> SLOW!
/// You can avoid this by using the "CreateTextureAndBitmask" function
//////
bool PixelPerfectTest(const sf::Sprite& Object1 ,const sf::Sprite& Object2, sf::Uint8 AlphaLimit, sf::Vector2f &point);
//////
/// Replaces Texture::loadFromFile
/// Load an imagefile into the given texture and create a bitmask for it
/// This is much faster than creating the bitmask for a texture on the first run of "PixelPerfectTest"
///
/// The function returns false if the file could not be opened for some reason
//////
bool CreateTextureAndBitmask(sf::Texture &LoadInto, const std::string& Filename);
//////
/// Test for collision using circle collision dection
/// Radius is averaged from the dimensions of the sprite so
/// roughly circular objects will be much more accurate
//////
bool CircleTest(const sf::Sprite& Object1, const sf::Sprite& Object2);
//////
/// Test for bounding box collision using the Separating Axis Theorem
/// Supports scaling and rotation
//////
bool BoundingBoxTest(const sf::Sprite& Object1, const sf::Sprite& Object2);
}
#endif //SFML_TEMPLATE_COLLISION_H

View file

@ -1,32 +1,32 @@
//
// Created by benmo on 5/7/2020.
//
#ifndef SFML_TEMPLATE_EXPLORE_H
#define SFML_TEMPLATE_EXPLORE_H
#include <string>
#include <utility>
class Explore {
private:
std::string type, message;
int moneyHigh, moneyLow, prestigeHigh, prestigeLow;
public:
Explore(std::string _type, std::string msg, int _moneyLow = 0, int _moneyHigh = 0, int _prestigeLow = 0, int _prestigeHigh = 0) {
message = std::move(msg);
type = _type;
moneyHigh = _moneyHigh;
moneyLow = _moneyLow;
prestigeHigh = _prestigeHigh;
prestigeLow = _prestigeLow;
}
std::string getMessage() {
return message;
}
};
#endif //SFML_TEMPLATE_EXPLORE_H
//
// Created by benmo on 5/7/2020.
//
#ifndef SFML_TEMPLATE_EXPLORE_H
#define SFML_TEMPLATE_EXPLORE_H
#include <string>
#include <utility>
class Explore {
private:
std::string type, message;
int moneyHigh, moneyLow, prestigeHigh, prestigeLow;
public:
Explore(std::string _type, std::string msg, int _moneyLow = 0, int _moneyHigh = 0, int _prestigeLow = 0, int _prestigeHigh = 0) {
message = std::move(msg);
type = _type;
moneyHigh = _moneyHigh;
moneyLow = _moneyLow;
prestigeHigh = _prestigeHigh;
prestigeLow = _prestigeLow;
}
std::string getMessage() {
return message;
}
};
#endif //SFML_TEMPLATE_EXPLORE_H

4401
Game.cpp

File diff suppressed because it is too large Load diff

132
Game.h
View file

@ -1,66 +1,66 @@
//
// Created by benmo on 2/14/2020.
//
#ifndef SFML_TEMPLATE_GAME_H
#define SFML_TEMPLATE_GAME_H
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include "GameSprite.h"
#include "Ship.h"
class Game {
private:
void init();
bool playedBip = false, playedErr = false, soundOn = true, musicOn = true;
sf::SoundBuffer bip;
sf::Sound bipSound;
sf::SoundBuffer err;
sf::Sound errSound;
sf::Texture loadingBarEmpty;
sf::Texture loadingBarFull;
sf::Font oxan;
std::vector<std::string> abstractNounNameComponents;
std::vector<std::string> adjectiveNameComponents;
std::vector<std::string> animalNameComponents;
std::vector<std::string> standaloneNameNameComponents;
std::vector<std::string> femaleNameNameComponents;
std::vector<std::string> femaleTitleNameComponents;
std::vector<std::string> neutralTitleNameComponents;
std::vector<std::string> maleNameNameComponents;
std::vector<std::string> maleTitleNameComponents;
std::vector<std::string> nounNameComponents;
std::vector<std::string> numberNameComponents;
std::vector<std::string> craftNameNameComponents;
//update total
int totalTextures = 195;
int loadedTextures = 0;
void playBip();
void playErr();
void readNameComponents();
template<class RNG >
std::string generateName(RNG &gen);
void updateLoader(sf::RenderWindow &window, const std::string& msg);
public:
const static int FRIENDLY_LOW = 100, NUETRAL_HIGH = 99, NUETRAL_LOW = 0, HOSTILE_HIGH = -1;
Game(bool _soundOn, bool _musicOn) {
soundOn = _soundOn;
musicOn = _musicOn;
init();
}
};
#endif //SFML_TEMPLATE_GAME_H
//
// Created by benmo on 2/14/2020.
//
#ifndef SFML_TEMPLATE_GAME_H
#define SFML_TEMPLATE_GAME_H
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include "GameSprite.h"
#include "Ship.h"
class Game {
private:
void init();
bool playedBip = false, playedErr = false, soundOn = true, musicOn = true;
sf::SoundBuffer bip;
sf::Sound bipSound;
sf::SoundBuffer err;
sf::Sound errSound;
sf::Texture loadingBarEmpty;
sf::Texture loadingBarFull;
sf::Font oxan;
std::vector<std::string> abstractNounNameComponents;
std::vector<std::string> adjectiveNameComponents;
std::vector<std::string> animalNameComponents;
std::vector<std::string> standaloneNameNameComponents;
std::vector<std::string> femaleNameNameComponents;
std::vector<std::string> femaleTitleNameComponents;
std::vector<std::string> neutralTitleNameComponents;
std::vector<std::string> maleNameNameComponents;
std::vector<std::string> maleTitleNameComponents;
std::vector<std::string> nounNameComponents;
std::vector<std::string> numberNameComponents;
std::vector<std::string> craftNameNameComponents;
//update total
int totalTextures = 195;
int loadedTextures = 0;
void playBip();
void playErr();
void readNameComponents();
template<class RNG >
std::string generateName(RNG &gen);
void updateLoader(sf::RenderWindow &window, const std::string& msg);
public:
const static int FRIENDLY_LOW = 100, NUETRAL_HIGH = 99, NUETRAL_LOW = 0, HOSTILE_HIGH = -1;
Game(bool _soundOn, bool _musicOn) {
soundOn = _soundOn;
musicOn = _musicOn;
init();
}
};
#endif //SFML_TEMPLATE_GAME_H

View file

@ -1,209 +1,209 @@
#include <iostream>
#include "GameSprite.h"
void GameSprite::init() {
spritePhysics.velocity = 0;
spritePhysics.xPos = 0;
spritePhysics.yPos = 0;
spritePhysics.direction = 0;
setOrigin(getGlobalBounds().width/2,getGlobalBounds().height/2);
}
GameSprite::GameSprite() : sf::Sprite() {
init();
}
GameSprite::GameSprite(const sf::Texture &texture) : sf::Sprite(texture) {
init();
}
GameSprite::GameSprite(const sf::Texture &texture, float scale) : sf::Sprite(texture) {
init();
setScale(scale/100, scale/100);
}
GameSprite::GameSprite(const sf::Texture &texture, const sf::IntRect &rectangle) : sf::Sprite(texture, rectangle) {
init();
}
GameSprite::GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float direction) : sf::Sprite(texture) {
spritePhysics.velocity = velocity;
spritePhysics.xPos = xPos;
spritePhysics.yPos = yPos;
spritePhysics.direction = direction;
setOrigin(getGlobalBounds().width/2,getGlobalBounds().height/2);
setScale(scale/100, scale/100);
setPosition(spritePhysics.xPos,spritePhysics.yPos);
setRotation(direction);
}
GameSprite::GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction) : GameSprite(texture, scale, xPos, yPos, velocity, direction) {
spritePhysics.maxVelocity = maxVelocity;
}
GameSprite::GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction, float rotVelocity, float maxRotVelocity) : GameSprite(texture, scale, xPos, yPos, velocity, maxVelocity, direction) {
spritePhysics.rotVelocity = rotVelocity;
spritePhysics.maxRotVelocity = maxRotVelocity;
}
GameSprite::GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float acceleration, float maxVelocity, float direction, float rotVelocity, float rotAcceleration, float maxRotVelocity) : GameSprite(texture, scale, xPos, yPos, velocity, maxVelocity, direction, rotVelocity, maxRotVelocity) {
spritePhysics.acceleration = acceleration;
spritePhysics.rotAcceleration = rotAcceleration;
}
GameSprite::GameSprite(const sf::Texture &texture, const sf::IntRect &rect, int _rows, int _cols, int _xOffset, int _yOffset, int _frameDelay) : GameSprite(texture, rect) {
rows = _rows;
cols = _cols;
xOffset = _xOffset;
yOffset = _yOffset;
frameDelay = _frameDelay;
initRect = rect;
isAnimated = true;
}
void GameSprite::update() {
framesAlive++;
if (isAnimated) updateAnimation();
calculateNewPosition();
calculateNewDirection();
setPosition(spritePhysics.xPos, spritePhysics.yPos);
setRotation(-spritePhysics.direction);
}
void GameSprite::nextTexture() {
currentCol++;
if (currentCol == cols) {
currentCol = 0;
currentRow++;
if (currentRow == rows) {
currentRow = 0;
}
}
sf::IntRect newRect(initRect.left + xOffset * currentCol, initRect.top + yOffset * currentRow, initRect.width, initRect.height);
setTextureRect(newRect);
}
void GameSprite::updateAnimation(bool override) {
currentFrame++;
if (override) {
nextTexture();
currentFrame = 0;
} else {
if (currentFrame == frameDelay) {
nextTexture();
currentFrame = 0;
}
}
}
void GameSprite::calculateNewDirection() {
spritePhysics.direction -= spritePhysics.rotVelocity;
spritePhysics.direction = fmod(spritePhysics.direction, 360);
if (spritePhysics.direction < 0)
spritePhysics.direction += 360;
}
void GameSprite::calculateNewPosition() {
spritePhysics.xPos += cos(spritePhysics.direction * (PI / 180)) * spritePhysics.velocity;
spritePhysics.yPos += -(sin(spritePhysics.direction * (PI / 180)) * spritePhysics.velocity);
}
void GameSprite::accelerate(float override, bool ignoreMax) {
if (override != 0) spritePhysics.velocity += override;
else spritePhysics.velocity += spritePhysics.acceleration;
if (!ignoreMax && std::abs(spritePhysics.velocity) > spritePhysics.maxVelocity) spritePhysics.velocity = spritePhysics.velocity > 0 ? spritePhysics.maxVelocity : -spritePhysics.maxVelocity;
}
void GameSprite::rotAccel(float override, bool ignoreMax) {
if (override != 0) spritePhysics.rotVelocity += override;
else spritePhysics.rotVelocity += spritePhysics.rotAcceleration;
if (!ignoreMax && spritePhysics.rotVelocity > spritePhysics.maxRotVelocity) spritePhysics.rotVelocity = spritePhysics.maxRotVelocity;
else if (!ignoreMax && -spritePhysics.rotVelocity > spritePhysics.maxRotVelocity) spritePhysics.rotVelocity = -spritePhysics.maxRotVelocity;
}
void GameSprite::turn(float degrees) {
spritePhysics.direction -= degrees;
setRotation(-spritePhysics.direction);
}
float GameSprite::getXPos() const {
return spritePhysics.xPos;
}
float GameSprite::getYPos() const {
return spritePhysics.yPos;
}
void GameSprite::setPosition(float xPos, float yPos) {
spritePhysics.xPos = xPos;
spritePhysics.yPos = yPos;
sf::Sprite::setPosition(sf::Vector2f(xPos, yPos));
}
void GameSprite::setPosition(const sf::Vector2f &vec) {
spritePhysics.xPos = vec.x;
spritePhysics.yPos = vec.y;
sf::Sprite::setPosition(vec);
}
float GameSprite::getDirection() const {
return spritePhysics.direction;
}
void GameSprite::setDirection(float angle) {
spritePhysics.direction = angle;
setRotation(-angle);
}
void GameSprite::setVelocity(float velo) {
spritePhysics.velocity = velo;
}
float GameSprite::getVelocity() const {
return spritePhysics.velocity;
}
double GameSprite::getAimAngle(const Sprite& b, const Sprite& a) {
return getAimAngle(b.getPosition(), a.getPosition());
}
double GameSprite::getAimAngle(sf::Vector2f b, sf::Vector2f a) {
double dx = b.x - a.x;
double dy = b.y - a.y;
double targetAngle = -((atan2(dy, dx)) * 180 / GameSprite::PI);
targetAngle = fmod(targetAngle, 360);
if (targetAngle < 0)
targetAngle += 360;
return -targetAngle;
}
int GameSprite::getFramesAlive() const {
return framesAlive;
}
bool GameSprite::isPastLifetime() const {
return lifetime != INFINITE && framesAlive >= lifetime;
}
int GameSprite::getLifetime() const {
return lifetime;
}
#include <iostream>
#include "GameSprite.h"
void GameSprite::init() {
spritePhysics.velocity = 0;
spritePhysics.xPos = 0;
spritePhysics.yPos = 0;
spritePhysics.direction = 0;
setOrigin(getGlobalBounds().width/2,getGlobalBounds().height/2);
}
GameSprite::GameSprite() : sf::Sprite() {
init();
}
GameSprite::GameSprite(const sf::Texture &texture) : sf::Sprite(texture) {
init();
}
GameSprite::GameSprite(const sf::Texture &texture, float scale) : sf::Sprite(texture) {
init();
setScale(scale/100, scale/100);
}
GameSprite::GameSprite(const sf::Texture &texture, const sf::IntRect &rectangle) : sf::Sprite(texture, rectangle) {
init();
}
GameSprite::GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float direction) : sf::Sprite(texture) {
spritePhysics.velocity = velocity;
spritePhysics.xPos = xPos;
spritePhysics.yPos = yPos;
spritePhysics.direction = direction;
setOrigin(getGlobalBounds().width/2,getGlobalBounds().height/2);
setScale(scale/100, scale/100);
setPosition(spritePhysics.xPos,spritePhysics.yPos);
setRotation(direction);
}
GameSprite::GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction) : GameSprite(texture, scale, xPos, yPos, velocity, direction) {
spritePhysics.maxVelocity = maxVelocity;
}
GameSprite::GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction, float rotVelocity, float maxRotVelocity) : GameSprite(texture, scale, xPos, yPos, velocity, maxVelocity, direction) {
spritePhysics.rotVelocity = rotVelocity;
spritePhysics.maxRotVelocity = maxRotVelocity;
}
GameSprite::GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float acceleration, float maxVelocity, float direction, float rotVelocity, float rotAcceleration, float maxRotVelocity) : GameSprite(texture, scale, xPos, yPos, velocity, maxVelocity, direction, rotVelocity, maxRotVelocity) {
spritePhysics.acceleration = acceleration;
spritePhysics.rotAcceleration = rotAcceleration;
}
GameSprite::GameSprite(const sf::Texture &texture, const sf::IntRect &rect, int _rows, int _cols, int _xOffset, int _yOffset, int _frameDelay) : GameSprite(texture, rect) {
rows = _rows;
cols = _cols;
xOffset = _xOffset;
yOffset = _yOffset;
frameDelay = _frameDelay;
initRect = rect;
isAnimated = true;
}
void GameSprite::update() {
framesAlive++;
if (isAnimated) updateAnimation();
calculateNewPosition();
calculateNewDirection();
setPosition(spritePhysics.xPos, spritePhysics.yPos);
setRotation(-spritePhysics.direction);
}
void GameSprite::nextTexture() {
currentCol++;
if (currentCol == cols) {
currentCol = 0;
currentRow++;
if (currentRow == rows) {
currentRow = 0;
}
}
sf::IntRect newRect(initRect.left + xOffset * currentCol, initRect.top + yOffset * currentRow, initRect.width, initRect.height);
setTextureRect(newRect);
}
void GameSprite::updateAnimation(bool override) {
currentFrame++;
if (override) {
nextTexture();
currentFrame = 0;
} else {
if (currentFrame == frameDelay) {
nextTexture();
currentFrame = 0;
}
}
}
void GameSprite::calculateNewDirection() {
spritePhysics.direction -= spritePhysics.rotVelocity;
spritePhysics.direction = fmod(spritePhysics.direction, 360);
if (spritePhysics.direction < 0)
spritePhysics.direction += 360;
}
void GameSprite::calculateNewPosition() {
spritePhysics.xPos += cos(spritePhysics.direction * (PI / 180)) * spritePhysics.velocity;
spritePhysics.yPos += -(sin(spritePhysics.direction * (PI / 180)) * spritePhysics.velocity);
}
void GameSprite::accelerate(float override, bool ignoreMax) {
if (override != 0) spritePhysics.velocity += override;
else spritePhysics.velocity += spritePhysics.acceleration;
if (!ignoreMax && std::abs(spritePhysics.velocity) > spritePhysics.maxVelocity) spritePhysics.velocity = spritePhysics.velocity > 0 ? spritePhysics.maxVelocity : -spritePhysics.maxVelocity;
}
void GameSprite::rotAccel(float override, bool ignoreMax) {
if (override != 0) spritePhysics.rotVelocity += override;
else spritePhysics.rotVelocity += spritePhysics.rotAcceleration;
if (!ignoreMax && spritePhysics.rotVelocity > spritePhysics.maxRotVelocity) spritePhysics.rotVelocity = spritePhysics.maxRotVelocity;
else if (!ignoreMax && -spritePhysics.rotVelocity > spritePhysics.maxRotVelocity) spritePhysics.rotVelocity = -spritePhysics.maxRotVelocity;
}
void GameSprite::turn(float degrees) {
spritePhysics.direction -= degrees;
setRotation(-spritePhysics.direction);
}
float GameSprite::getXPos() const {
return spritePhysics.xPos;
}
float GameSprite::getYPos() const {
return spritePhysics.yPos;
}
void GameSprite::setPosition(float xPos, float yPos) {
spritePhysics.xPos = xPos;
spritePhysics.yPos = yPos;
sf::Sprite::setPosition(sf::Vector2f(xPos, yPos));
}
void GameSprite::setPosition(const sf::Vector2f &vec) {
spritePhysics.xPos = vec.x;
spritePhysics.yPos = vec.y;
sf::Sprite::setPosition(vec);
}
float GameSprite::getDirection() const {
return spritePhysics.direction;
}
void GameSprite::setDirection(float angle) {
spritePhysics.direction = angle;
setRotation(-angle);
}
void GameSprite::setVelocity(float velo) {
spritePhysics.velocity = velo;
}
float GameSprite::getVelocity() const {
return spritePhysics.velocity;
}
double GameSprite::getAimAngle(const Sprite& b, const Sprite& a) {
return getAimAngle(b.getPosition(), a.getPosition());
}
double GameSprite::getAimAngle(sf::Vector2f b, sf::Vector2f a) {
double dx = b.x - a.x;
double dy = b.y - a.y;
double targetAngle = -((atan2(dy, dx)) * 180 / GameSprite::PI);
targetAngle = fmod(targetAngle, 360);
if (targetAngle < 0)
targetAngle += 360;
return -targetAngle;
}
int GameSprite::getFramesAlive() const {
return framesAlive;
}
bool GameSprite::isPastLifetime() const {
return lifetime != INFINITE && framesAlive >= lifetime;
}
int GameSprite::getLifetime() const {
return lifetime;
}

View file

@ -1,109 +1,109 @@
//
// Created by benmo on 2/14/2020.
//
#ifndef SFML_TEMPLATE_SPRITE_H
#define SFML_TEMPLATE_SPRITE_H
#include <string>
#include <SFML/Graphics.hpp>
#include <cmath>
#ifndef INFINITE
#define INFINITE -1
#endif
#ifdef VISIBLE
#define VISIBLE -2
#endif
class GameSprite: public sf::Sprite{
protected:
struct Physics {
float velocity, direction, acceleration, maxVelocity;
float rotVelocity, rotAcceleration, maxRotVelocity;
float xPos, yPos;
};
Physics spritePhysics{};
bool isAnimated = false;
int currentFrame = 0, frameDelay = 0, currentRow = 0, currentCol = 0, rows, cols, xOffset, yOffset;
sf::IntRect initRect;
int lifetime = INFINITE;
int framesAlive = 0;
void nextTexture();
public:
constexpr static const double PI = 3.1415926;
static double distance(sf::Vector2f pos1, sf::Vector2f pos2) {
return sqrt(pow(pos2.x - pos1.x, 2) + pow(pos2.y - pos1.y, 2));
}
/*
* Contructors
*/
GameSprite();
explicit GameSprite(const sf::Texture &texture);
GameSprite(const sf::Texture &texture, float scale);
GameSprite(const sf::Texture &texture, const sf::IntRect &rectangle);
GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float direction);
GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction, float rotVelocity, float maxRotVelocity);
GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float acceleration, float maxVelocity, float direction, float rotVelocity, float rotAcceleration, float maxRotVelocity);
GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction);
GameSprite(const sf::Texture& texture, const sf::IntRect &rect, int _rows, int _cols, int _xOffset, int _yOffset, int frameDelay);
void init();
/**
* Updates sprite's position, direction, velocities, etc. every tick based on its Physics struct
*/
void update();
void updateAnimation(bool override = false);
/*
* Helper functions for update()
*/
void calculateNewDirection();
void calculateNewPosition();
/**
* Accelerates ship by acceleration stat, can be overridden
* @param override - Used to override acceleration stat default 0
* @param ignoreMax - When false, maximum velocity will be honored when calculating new velocity default false
*/
void accelerate(float override = 0, bool ignoreMax = false);
/**
* Accelerates ship rotationally by rotational acceleration stat, can be overridden
* @param override - Used to override acceleration stat default 0
* @param ignoreMax - When false, maximum rotational velocity will be honored when calculating new velocity default false
*/
void rotAccel(float override = 0, bool ignoreMax = false);
void turn(float degrees);
float getXPos() const;
float getYPos() const;
void setPosition(float xPos, float yPos);
void setPosition(const sf::Vector2f &vec);
float getDirection() const;
void setDirection(float angle);
void setVelocity(float velo);
float getVelocity() const;
static double getAimAngle(const Sprite& b, const Sprite& a);
static double getAimAngle(sf::Vector2f b, sf::Vector2f a);
int getFramesAlive() const;
bool isPastLifetime() const;
int getLifetime() const;
};
#endif //SFML_TEMPLATE_SPRITE_H
//
// Created by benmo on 2/14/2020.
//
#ifndef SFML_TEMPLATE_SPRITE_H
#define SFML_TEMPLATE_SPRITE_H
#include <string>
#include <SFML/Graphics.hpp>
#include <cmath>
#ifndef INFINITE
#define INFINITE -1
#endif
#ifdef VISIBLE
#define VISIBLE -2
#endif
class GameSprite: public sf::Sprite{
protected:
struct Physics {
float velocity, direction, acceleration, maxVelocity;
float rotVelocity, rotAcceleration, maxRotVelocity;
float xPos, yPos;
};
Physics spritePhysics{};
bool isAnimated = false;
int currentFrame = 0, frameDelay = 0, currentRow = 0, currentCol = 0, rows, cols, xOffset, yOffset;
sf::IntRect initRect;
int lifetime = INFINITE;
int framesAlive = 0;
void nextTexture();
public:
constexpr static const double PI = 3.1415926;
static double distance(sf::Vector2f pos1, sf::Vector2f pos2) {
return sqrt(pow(pos2.x - pos1.x, 2) + pow(pos2.y - pos1.y, 2));
}
/*
* Contructors
*/
GameSprite();
explicit GameSprite(const sf::Texture &texture);
GameSprite(const sf::Texture &texture, float scale);
GameSprite(const sf::Texture &texture, const sf::IntRect &rectangle);
GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float direction);
GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction, float rotVelocity, float maxRotVelocity);
GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float acceleration, float maxVelocity, float direction, float rotVelocity, float rotAcceleration, float maxRotVelocity);
GameSprite(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction);
GameSprite(const sf::Texture& texture, const sf::IntRect &rect, int _rows, int _cols, int _xOffset, int _yOffset, int frameDelay);
void init();
/**
* Updates sprite's position, direction, velocities, etc. every tick based on its Physics struct
*/
virtual void update();
void updateAnimation(bool override = false);
/*
* Helper functions for update()
*/
void calculateNewDirection();
void calculateNewPosition();
/**
* Accelerates ship by acceleration stat, can be overridden
* @param override - Used to override acceleration stat default 0
* @param ignoreMax - When false, maximum velocity will be honored when calculating new velocity default false
*/
void accelerate(float override = 0, bool ignoreMax = false);
/**
* Accelerates ship rotationally by rotational acceleration stat, can be overridden
* @param override - Used to override acceleration stat default 0
* @param ignoreMax - When false, maximum rotational velocity will be honored when calculating new velocity default false
*/
void rotAccel(float override = 0, bool ignoreMax = false);
void turn(float degrees);
float getXPos() const;
float getYPos() const;
void setPosition(float xPos, float yPos);
void setPosition(const sf::Vector2f &vec);
float getDirection() const;
void setDirection(float angle);
void setVelocity(float velo);
float getVelocity() const;
static double getAimAngle(const Sprite& b, const Sprite& a);
static double getAimAngle(sf::Vector2f b, sf::Vector2f a);
int getFramesAlive() const;
bool isPastLifetime() const;
int getLifetime() const;
};
#endif //SFML_TEMPLATE_SPRITE_H

1348
LICENSE

File diff suppressed because it is too large Load diff

898
Menu.cpp
View file

@ -1,450 +1,450 @@
//
// Created by benmo on 2/20/2020.
//
#include <iostream>
#include <windows.h>
#include <shellapi.h>
#include <winuser.h>
#include "Menu.h"
#include "GameSprite.h"
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>
int Menu::init() {
const int MENU = 0, CREDITS = 1;
int screen = MENU;
std::vector<GameSprite*> buttons;
std::vector<sf::Text*> text;
std::vector<sf::Text*> credits;
std::vector<sf::Sprite*> creditsGUI;
sf::RenderWindow window( sf::VideoMode(1240, 640), "Star Captain" );
sf::View mainView;
mainView.setCenter(window.getSize().x/(float)2.0, window.getSize().y/(float)2.0);
mainView.setSize(window.getSize().x, window.getSize().y);
window.setView(mainView);
window.setPosition(sf::Vector2i(window.getPosition().x, window.getPosition().y - 20));
/*************************************************
* File Input && Processing
*************************************************/
sf::Font sk;
sk.loadFromFile("./data/Fonts/Sk.ttf");
sf::Font skME;
skME.loadFromFile("./data/Fonts/SKoME.ttf");
sf::Font xolo;
xolo.loadFromFile("./data/Fonts/Xolonium-Bold.ttf");
sf::Font monkirta;
monkirta.loadFromFile("./data/Fonts/Monkirta Pursuit NC.ttf");
sf::Font oxan;
oxan.loadFromFile("./data/Fonts/Oxanium-Light.ttf");
sf::Texture back;
back.loadFromFile("./data/Gui/space.png");
back.setRepeated(true);
sf::Texture button;
button.loadFromFile("./data/Gui/button.png");
sf::Texture box;
box.loadFromFile("./data/Gui/window.png");
sf::Texture boxSm;
boxSm.loadFromFile("./data/Gui/windowSm.png");
sf::Texture cloud;
cloud.loadFromFile("./data/Gui/cloud.png");
sf::Texture leftArrow;
leftArrow.loadFromFile("./data/Gui/Backward_BTN.png");
sf::Texture soundBTN;
soundBTN.loadFromFile("./data/Gui/Sound.png");
sf::Texture musicBTN;
musicBTN.loadFromFile("./data/Gui/Music.png");
sf::Music menuLoop;
menuLoop.openFromFile("./data/Sounds/Menu Loop.wav");
menuLoop.setLoop(true);
menuLoop.play();
bip.loadFromFile("./data/Sounds/rollover.wav");
/*************************************************
* Object Initialization
*************************************************/
//Background pan sprite
sf::Sprite background(back);
sf::FloatRect fBounds(mainView.getCenter().x, mainView.getCenter().y, background.getTexture()->getSize().x * 3, background.getTexture()->getSize().y * 3);
sf::IntRect iBounds(fBounds);
background.setTextureRect(iBounds);
background.setPosition(mainView.getCenter());
background.setOrigin(iBounds.width/(float)2.0,iBounds.height/(float)2.0);
//Sound settings
GameSprite soundButton(soundBTN, 25, 35, 37, 0, 0);
GameSprite musicButton(musicBTN, 25, soundButton.getXPos() + soundButton.getGlobalBounds().width, soundButton.getYPos(), 0, 0);
//Title text
sf::Text title("Star Captain", skME, 90);
title.setPosition(mainView.getCenter().x, mainView.getCenter().y - window.getSize().y / (float)3.0);
title.setFillColor(sf::Color::White);
title.setLetterSpacing(title.getLetterSpacing() + (float)0.5);
title.setOrigin(title.getGlobalBounds().width/(float)2.0, title.getGlobalBounds().height/(float)2.0);
//Start button & text
GameSprite startButton(button, 55);
startButton.setPosition(mainView.getCenter().x, mainView.getCenter().y - window.getSize().y / (float)12.0);
//default button color
sf::Color defButtonColor = startButton.getColor();
sf::Text startText("Start", sk, 28);
startText.setPosition(startButton.getPosition().x, startButton.getPosition().y - 7);
startText.setFillColor(sf::Color(0,0,0,0));
startText.setOutlineColor(sf::Color::White);
startText.setOutlineThickness(1);
startText.setLetterSpacing(startText.getLetterSpacing() + 1);
startText.setOrigin(startText.getLocalBounds().width/2, startText.getLocalBounds().height/2);
//Credits button & text
GameSprite creditsButton(button, 55);
creditsButton.setPosition(mainView.getCenter().x, mainView.getCenter().y);
sf::Text creditsText("Credits", sk, 28);
creditsText.setPosition(creditsButton.getPosition().x, creditsButton.getPosition().y - 6);
creditsText.setFillColor(sf::Color(0,0,0,0));
creditsText.setOutlineColor(sf::Color::White);
creditsText.setOutlineThickness(1);
creditsText.setLetterSpacing(creditsText.getLetterSpacing() + 1);
creditsText.setOrigin(creditsText.getLocalBounds().width/2, creditsText.getLocalBounds().height/2);
//Exit button & text
GameSprite exitButton(button, 55);
exitButton.setPosition(mainView.getCenter().x, mainView.getCenter().y + window.getSize().y / (float)12.0);
sf::Text exitText("Exit", sk, 28);
exitText.setPosition(mainView.getCenter().x, exitButton.getPosition().y - 6);
exitText.setFillColor(sf::Color(0,0,0,0));
exitText.setOutlineColor(sf::Color::White);
exitText.setOutlineThickness(1);
exitText.setLetterSpacing(exitText.getLetterSpacing() + 1);
exitText.setOrigin(exitText.getLocalBounds().width/2, exitText.getLocalBounds().height/2);
buttons.push_back(&startButton);
buttons.push_back(&creditsButton);
buttons.push_back(&exitButton);
text.push_back(&startText);
text.push_back(&creditsText);
text.push_back(&exitText);
//Credits
sf::Text creditsTitle("Credits + Resources", sk, 70);
creditsTitle.setPosition(mainView.getCenter().x, window.getSize().y / (float)14.0);
creditsTitle.setFillColor(sf::Color::White);
creditsTitle.setOrigin(creditsTitle.getGlobalBounds().width/2, creditsTitle.getGlobalBounds().height/2);
//Credits box
sf::Text credsTitle("Credits", xolo, 28);
credsTitle.setOrigin(credsTitle.getGlobalBounds().width/2, credsTitle.getGlobalBounds().height/2);
credsTitle.setPosition(mainView.getSize().x/(float)5.1, mainView.getSize().y/2 + mainView.getSize().y/22);
credsTitle.setFillColor(sf::Color::White);
sf::Text music("River Schreckengost - ", monkirta, 20);
music.setOrigin(music.getGlobalBounds().width/2, music.getGlobalBounds().height/2);
music.setPosition(mainView.getSize().x/(float)5.8, mainView.getSize().y/(float)2 + mainView.getSize().y/(float)8.5);
music.setFillColor(sf::Color::White);
sf::Text musicText("Music", oxan, 15);
musicText.setPosition(mainView.getSize().x/(float)5.8 + music.getGlobalBounds().width/2, mainView.getSize().y/(float)2 + mainView.getSize().y/(float)8.925);
musicText.setFillColor(sf::Color::White);
sf::Text musicLabel("Instagram - ", monkirta, 15);
musicLabel.setPosition(mainView.getSize().x/(float)11.5, mainView.getSize().y/(float)2 + mainView.getSize().y/(float)7.3);
musicLabel.setFillColor(sf::Color::White);
sf::Text musicText0("@river.schreck", oxan, 12);
musicText0.setPosition(mainView.getSize().x/(float)11.5 + musicLabel.getGlobalBounds().width, mainView.getSize().y/(float)2 + mainView.getSize().y/(float)7.15);
musicText0.setFillColor(sf::Color::White);
musicText0.setStyle(sf::Text::Style::Underlined);
sf::Text musicLabel0("SoundCloud - ", monkirta, 15);
musicLabel0.setPosition(mainView.getSize().x/(float)11.5, mainView.getSize().y/(float)2 + mainView.getSize().y/(float)6.1);
musicLabel0.setFillColor(sf::Color::White);
sf::Text musicText1("River Ethans", oxan, 12);
musicText1.setPosition(mainView.getSize().x/(float)11.5 + musicLabel0.getGlobalBounds().width, mainView.getSize().y/(float)2 + mainView.getSize().y/(float)5.95);
musicText1.setFillColor(sf::Color::White);
musicText1.setStyle(sf::Text::Style::Underlined);
//Resources Box
sf::Text resourcesTitle("Resources", xolo, 28);
resourcesTitle.setOrigin(resourcesTitle.getGlobalBounds().width/2, resourcesTitle.getGlobalBounds().height/2);
resourcesTitle.setPosition(mainView.getSize().x - mainView.getSize().x/(float)4.95, mainView.getSize().y/(float)4.8);
resourcesTitle.setFillColor(sf::Color::White);
//Dev box
sf::Text developerTitle("Developer: ", xolo, 25);
developerTitle.setPosition(mainView.getSize().x/13, mainView.getSize().y/(float)5.2);
developerTitle.setFillColor(sf::Color(0,0,0,0));
developerTitle.setOutlineThickness(.8);
developerTitle.setOutlineColor(sf::Color::White);
sf::Text developer("Benjamin Morgan", monkirta, 20);
developer.setOrigin(developer.getGlobalBounds().width/2, developer.getGlobalBounds().height/2);
developer.setPosition(mainView.getSize().x/(float)6.725, mainView.getSize().y/(float)3.95);
developer.setFillColor(sf::Color::White);
sf::Text devLabel("Site - ", monkirta, 15);
devLabel.setPosition(mainView.getSize().x/(float)11.5, mainView.getSize().y/(float)3.65);
devLabel.setFillColor(sf::Color::White);
sf::Text devText("https://bmorgan01.github.io/Portfolio-Blog/", oxan, 12);
devText.setPosition(mainView.getSize().x/(float)11.5 + devLabel.getGlobalBounds().width, mainView.getSize().y/(float)3.6);
devText.setFillColor(sf::Color::White);
devText.setStyle(sf::Text::Style::Underlined);
sf::Text devLabel0("Github - ", monkirta, 15);
devLabel0.setPosition(mainView.getSize().x/(float)11.5, mainView.getSize().y/(float)3.35);
devLabel0.setFillColor(sf::Color::White);
sf::Text devText0("bMorgan01", oxan, 12);
devText0.setPosition(mainView.getSize().x/(float)11.5 + devLabel0.getGlobalBounds().width, mainView.getSize().y/(float)3.3);
devText0.setFillColor(sf::Color::White);
devText0.setStyle(sf::Text::Style::Underlined);
sf::Text devLabel1("Email - ", monkirta, 15);
devLabel1.setPosition(mainView.getSize().x/(float)11.5, mainView.getSize().y/(float)3.1);
devLabel1.setFillColor(sf::Color::White);
sf::Text devText1("ben.morgan5000@gmail.com", oxan, 12);
devText1.setPosition(mainView.getSize().x/(float)11.5 + devLabel1.getGlobalBounds().width, mainView.getSize().y/(float)3.05);
devText1.setFillColor(sf::Color::White);
sf::Text devLabel2("Repo - ", monkirta, 15);
devLabel2.setPosition(mainView.getSize().x/(float)11.5, mainView.getSize().y/(float)2.87);
devLabel2.setFillColor(sf::Color::White);
sf::Text devText2("https://github.com/bMorgan01/StarCap", oxan, 12);
devText2.setPosition(mainView.getSize().x/(float)11.5 + devLabel2.getGlobalBounds().width, mainView.getSize().y/(float)2.83);
devText2.setFillColor(sf::Color::White);
devText2.setStyle(sf::Text::Style::Underlined);
//Credits GUI
sf::Sprite backButton(leftArrow);
backButton.setScale(.3, .3);
backButton.setPosition(33, 100);
sf::Sprite textBox(box);
textBox.setScale(.35, .35);
textBox.setPosition(mainView.getSize().x - mainView.getSize().x/3, mainView.getSize().y/(float)5.5);
sf::Sprite textBoxSm(boxSm);
textBoxSm.setScale(.35, .35);
textBoxSm.setPosition(mainView.getSize().x/15, mainView.getSize().y/2 + mainView.getSize().y/50);
sf::Sprite devBox(cloud);
devBox.setScale(.442, .442);
devBox.setPosition(mainView.getSize().x/15 - 2, mainView.getSize().y/(float)5.5);
sf::Sprite issueButton(button);
issueButton.setColor(sf::Color::Red);
issueButton.setScale(40.0/100.0, 40.0/100.0);
issueButton.setOrigin(issueButton.getGlobalBounds().width/2, issueButton.getGlobalBounds().height/2);
issueButton.setPosition(mainView.getSize().x/(float)6.2, mainView.getSize().y/(float)2.52);
sf::Text issueText("Report Bug", sk, 16);
issueText.setPosition(issueButton.getPosition().x - 21, issueButton.getPosition().y);
issueText.setFillColor(sf::Color(0,0,0,0));
issueText.setFillColor(sf::Color::White);
credits.push_back(&creditsTitle);
credits.push_back(&developerTitle);
credits.push_back(&credsTitle);
credits.push_back(&music);
credits.push_back(&musicText);
credits.push_back(&musicLabel);
credits.push_back(&musicText0);
credits.push_back(&musicLabel0);
credits.push_back(&musicText1);
credits.push_back(&resourcesTitle);
credits.push_back(&developer);
credits.push_back(&devLabel);
credits.push_back(&devText);
credits.push_back(&devLabel0);
credits.push_back(&devText0);
credits.push_back(&devLabel1);
credits.push_back(&devText1);
credits.push_back(&devLabel2);
credits.push_back(&devText2);
credits.push_back(&issueText);
creditsGUI.push_back(&backButton);
creditsGUI.push_back(&textBox);
creditsGUI.push_back(&textBoxSm);
creditsGUI.push_back(&devBox);
creditsGUI.push_back(&issueButton);
while( window.isOpen() ) {
/*********************************************
* Pre-draw ops here.
*********************************************/
/*********************************************
* Drawing goes here.
*********************************************/
window.clear( sf::Color::Black ); // clear the contents of the old frame
window.draw(background);
switch(screen) {
case MENU:
/**************
* Draw Menu
**************/
backButton.setPosition(33, 100);
//Sound buttons
window.draw(soundButton);
window.draw(musicButton);
//Title text
window.draw(title);
for (int i = 0; i < buttons.size(); i++) {
window.draw(*buttons[i]);
window.draw(*text[i]);
}
break;
case CREDITS:
/**************
* Draw Credits
**************/
backButton.setPosition(33, 27);
for (sf::Sprite *s : creditsGUI) {
window.draw(*s);
}
for (sf::Text *t : credits) {
window.draw(*t);
}
break;
}
window.display(); // display the window
sf::Event event{};
while( window.pollEvent(event) ) { // ask the window if any events occurred
/*********************************************
* Event handling here.
*********************************************/
sf::Vector2i mousePos = sf::Mouse::getPosition( window );
sf::Vector2f mousePosF( static_cast<float>( mousePos.x ), static_cast<float>( mousePos.y ) );
switch (event.type) {
case sf::Event::Closed: //user clicked X button
window.close();
break;
case sf::Event::MouseButtonPressed: //User clicked mouse
if (exitButton.getGlobalBounds().contains(mousePosF) && screen == MENU) {
playBip();
return EXIT_FAILURE;
} else if (startButton.getGlobalBounds().contains(mousePosF) && screen == MENU) {
playBip();
return EXIT_SUCCESS;
} else if (creditsButton.getGlobalBounds().contains(mousePosF) && screen == MENU) {
playBip();
screen = CREDITS;
} else if (issueButton.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
ShellExecute(nullptr, "open", "https://github.com/bMorgan01/StarCap/issues", nullptr, nullptr, SW_SHOWNORMAL);
} else if (devText.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
ShellExecute(nullptr, "open", "https://bmorgan01.github.io/Portfolio-Blog/", nullptr, nullptr, SW_SHOWNORMAL);
} else if (devText0.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
ShellExecute(nullptr, "open", "https://github.com/bMorgan01", nullptr, nullptr, SW_SHOWNORMAL);
} else if (devText2.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
ShellExecute(nullptr, "open", "https://github.com/bMorgan01/StarCap", nullptr, nullptr, SW_SHOWNORMAL);
} else if (musicText0.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
ShellExecute(nullptr, "open", "https://www.instagram.com/river.schreck/", nullptr, nullptr, SW_SHOWNORMAL);
} else if (musicText1.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
ShellExecute(nullptr, "open", "https://soundcloud.com/riverethans", nullptr, nullptr, SW_SHOWNORMAL);
} else if (backButton.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
screen = MENU;
} else if (soundButton.getGlobalBounds().contains(mousePosF) && screen == MENU) {
soundOn = !soundOn;
playBip();
} else if (musicButton.getGlobalBounds().contains(mousePosF) && screen == MENU) {
playBip();
musicOn = !musicOn;
if (!musicOn) menuLoop.setVolume(0);
else menuLoop.setVolume(100);
}
break;
case sf::Event::MouseMoved:
if (exitButton.getGlobalBounds().contains(mousePosF) && screen == MENU) exitButton.setColor(sf::Color::Red);
else if (startButton.getGlobalBounds().contains(mousePosF) && screen == MENU) startButton.setColor(sf::Color::Red);
else if (creditsButton.getGlobalBounds().contains(mousePosF) && screen == MENU) creditsButton.setColor(sf::Color::Red);
else if (issueButton.getGlobalBounds().contains(mousePosF) && screen == CREDITS) issueButton.setColor(sf::Color::Green);
else if (devText.getGlobalBounds().contains(mousePosF) && screen == CREDITS) devText.setFillColor(sf::Color::Red);
else if (devText0.getGlobalBounds().contains(mousePosF) && screen == CREDITS) devText0.setFillColor(sf::Color::Red);
else if (devText2.getGlobalBounds().contains(mousePosF) && screen == CREDITS) devText2.setFillColor(sf::Color::Red);
else if (musicText0.getGlobalBounds().contains(mousePosF) && screen == CREDITS) musicText0.setFillColor(sf::Color::Red);
else if (musicText1.getGlobalBounds().contains(mousePosF) && screen == CREDITS) musicText1.setFillColor(sf::Color::Red);
else if (backButton.getGlobalBounds().contains(mousePosF) && screen == CREDITS) backButton.setColor(sf::Color::Red);
else if (soundButton.getGlobalBounds().contains(mousePosF) && soundOn && screen == MENU) soundButton.setColor(sf::Color::Red);
else if (musicButton.getGlobalBounds().contains(mousePosF) && musicOn && screen == MENU) musicButton.setColor(sf::Color::Red);
else if (soundButton.getGlobalBounds().contains(mousePosF) && !soundOn && screen == MENU) soundButton.setColor(sf::Color::White);
else if (musicButton.getGlobalBounds().contains(mousePosF) && !musicOn && screen == MENU) musicButton.setColor(sf::Color::White);
break;
}
if (!exitButton.getGlobalBounds().contains(mousePosF)) exitButton.setColor(defButtonColor);
if (!startButton.getGlobalBounds().contains(mousePosF)) startButton.setColor(defButtonColor);
if (!creditsButton.getGlobalBounds().contains(mousePosF)) creditsButton.setColor(defButtonColor);
if (!issueButton.getGlobalBounds().contains(mousePosF)) issueButton.setColor(sf::Color::Red);
if (!devText.getGlobalBounds().contains(mousePosF)) devText.setFillColor(sf::Color::White);
if (!devText0.getGlobalBounds().contains(mousePosF)) devText0.setFillColor(sf::Color::White);
if (!devText2.getGlobalBounds().contains(mousePosF)) devText2.setFillColor(sf::Color::White);
if (!musicText0.getGlobalBounds().contains(mousePosF)) musicText0.setFillColor(sf::Color::White);
if (!musicText1.getGlobalBounds().contains(mousePosF)) musicText1.setFillColor(sf::Color::White);
if (!backButton.getGlobalBounds().contains(mousePosF)) backButton.setColor(defButtonColor);
if (!soundButton.getGlobalBounds().contains(mousePosF) && soundOn) soundButton.setColor(sf::Color::White);
if (!musicButton.getGlobalBounds().contains(mousePosF) && musicOn) musicButton.setColor(sf::Color::White);
if (!soundButton.getGlobalBounds().contains(mousePosF) && !soundOn) soundButton.setColor(sf::Color::Red);
if (!musicButton.getGlobalBounds().contains(mousePosF) && !musicOn) musicButton.setColor(sf::Color::Red);
}
}
return EXIT_FAILURE;
}
void Menu::playBip() {
if (soundOn) {
bipSound.setBuffer(bip);
bipSound.setVolume(100);
bipSound.play();
}
//
// Created by benmo on 2/20/2020.
//
#include <iostream>
#include <windows.h>
#include <shellapi.h>
#include <winuser.h>
#include "Menu.h"
#include "GameSprite.h"
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>
int Menu::init() {
const int MENU = 0, CREDITS = 1;
int screen = MENU;
std::vector<GameSprite*> buttons;
std::vector<sf::Text*> text;
std::vector<sf::Text*> credits;
std::vector<sf::Sprite*> creditsGUI;
sf::RenderWindow window( sf::VideoMode(1240, 640), "Star Captain" );
sf::View mainView;
mainView.setCenter(window.getSize().x/(float)2.0, window.getSize().y/(float)2.0);
mainView.setSize(window.getSize().x, window.getSize().y);
window.setView(mainView);
window.setPosition(sf::Vector2i(window.getPosition().x, window.getPosition().y - 20));
/*************************************************
* File Input && Processing
*************************************************/
sf::Font sk;
sk.loadFromFile("./data/Fonts/Sk.ttf");
sf::Font skME;
skME.loadFromFile("./data/Fonts/SKoME.ttf");
sf::Font xolo;
xolo.loadFromFile("./data/Fonts/Xolonium-Bold.ttf");
sf::Font monkirta;
monkirta.loadFromFile("./data/Fonts/Monkirta Pursuit NC.ttf");
sf::Font oxan;
oxan.loadFromFile("./data/Fonts/Oxanium-Light.ttf");
sf::Texture back;
back.loadFromFile("./data/Gui/space.png");
back.setRepeated(true);
sf::Texture button;
button.loadFromFile("./data/Gui/button.png");
sf::Texture box;
box.loadFromFile("./data/Gui/window.png");
sf::Texture boxSm;
boxSm.loadFromFile("./data/Gui/windowSm.png");
sf::Texture cloud;
cloud.loadFromFile("./data/Gui/cloud.png");
sf::Texture leftArrow;
leftArrow.loadFromFile("./data/Gui/Backward_BTN.png");
sf::Texture soundBTN;
soundBTN.loadFromFile("./data/Gui/Sound.png");
sf::Texture musicBTN;
musicBTN.loadFromFile("./data/Gui/Music.png");
sf::Music menuLoop;
menuLoop.openFromFile("./data/Sounds/Menu Loop.wav");
menuLoop.setLoop(true);
menuLoop.play();
bip.loadFromFile("./data/Sounds/rollover.wav");
/*************************************************
* Object Initialization
*************************************************/
//Background pan sprite
sf::Sprite background(back);
sf::FloatRect fBounds(mainView.getCenter().x, mainView.getCenter().y, background.getTexture()->getSize().x * 3, background.getTexture()->getSize().y * 3);
sf::IntRect iBounds(fBounds);
background.setTextureRect(iBounds);
background.setPosition(mainView.getCenter());
background.setOrigin(iBounds.width/(float)2.0,iBounds.height/(float)2.0);
//Sound settings
GameSprite soundButton(soundBTN, 25, 35, 37, 0, 0);
GameSprite musicButton(musicBTN, 25, soundButton.getXPos() + soundButton.getGlobalBounds().width, soundButton.getYPos(), 0, 0);
//Title text
sf::Text title("Star Captain", skME, 90);
title.setPosition(mainView.getCenter().x, mainView.getCenter().y - window.getSize().y / (float)3.0);
title.setFillColor(sf::Color::White);
title.setLetterSpacing(title.getLetterSpacing() + (float)0.5);
title.setOrigin(title.getGlobalBounds().width/(float)2.0, title.getGlobalBounds().height/(float)2.0);
//Start button & text
GameSprite startButton(button, 55);
startButton.setPosition(mainView.getCenter().x, mainView.getCenter().y - window.getSize().y / (float)12.0);
//default button color
sf::Color defButtonColor = startButton.getColor();
sf::Text startText("Start", sk, 28);
startText.setPosition(startButton.getPosition().x, startButton.getPosition().y - 7);
startText.setFillColor(sf::Color(0,0,0,0));
startText.setOutlineColor(sf::Color::White);
startText.setOutlineThickness(1);
startText.setLetterSpacing(startText.getLetterSpacing() + 1);
startText.setOrigin(startText.getLocalBounds().width/2, startText.getLocalBounds().height/2);
//Credits button & text
GameSprite creditsButton(button, 55);
creditsButton.setPosition(mainView.getCenter().x, mainView.getCenter().y);
sf::Text creditsText("Credits", sk, 28);
creditsText.setPosition(creditsButton.getPosition().x, creditsButton.getPosition().y - 6);
creditsText.setFillColor(sf::Color(0,0,0,0));
creditsText.setOutlineColor(sf::Color::White);
creditsText.setOutlineThickness(1);
creditsText.setLetterSpacing(creditsText.getLetterSpacing() + 1);
creditsText.setOrigin(creditsText.getLocalBounds().width/2, creditsText.getLocalBounds().height/2);
//Exit button & text
GameSprite exitButton(button, 55);
exitButton.setPosition(mainView.getCenter().x, mainView.getCenter().y + window.getSize().y / (float)12.0);
sf::Text exitText("Exit", sk, 28);
exitText.setPosition(mainView.getCenter().x, exitButton.getPosition().y - 6);
exitText.setFillColor(sf::Color(0,0,0,0));
exitText.setOutlineColor(sf::Color::White);
exitText.setOutlineThickness(1);
exitText.setLetterSpacing(exitText.getLetterSpacing() + 1);
exitText.setOrigin(exitText.getLocalBounds().width/2, exitText.getLocalBounds().height/2);
buttons.push_back(&startButton);
buttons.push_back(&creditsButton);
buttons.push_back(&exitButton);
text.push_back(&startText);
text.push_back(&creditsText);
text.push_back(&exitText);
//Credits
sf::Text creditsTitle("Credits + Resources", sk, 70);
creditsTitle.setPosition(mainView.getCenter().x, window.getSize().y / (float)14.0);
creditsTitle.setFillColor(sf::Color::White);
creditsTitle.setOrigin(creditsTitle.getGlobalBounds().width/2, creditsTitle.getGlobalBounds().height/2);
//Credits box
sf::Text credsTitle("Credits", xolo, 28);
credsTitle.setOrigin(credsTitle.getGlobalBounds().width/2, credsTitle.getGlobalBounds().height/2);
credsTitle.setPosition(mainView.getSize().x/(float)5.1, mainView.getSize().y/2 + mainView.getSize().y/22);
credsTitle.setFillColor(sf::Color::White);
sf::Text music("River Schreckengost - ", monkirta, 20);
music.setOrigin(music.getGlobalBounds().width/2, music.getGlobalBounds().height/2);
music.setPosition(mainView.getSize().x/(float)5.8, mainView.getSize().y/(float)2 + mainView.getSize().y/(float)8.5);
music.setFillColor(sf::Color::White);
sf::Text musicText("Music", oxan, 15);
musicText.setPosition(mainView.getSize().x/(float)5.8 + music.getGlobalBounds().width/2, mainView.getSize().y/(float)2 + mainView.getSize().y/(float)8.925);
musicText.setFillColor(sf::Color::White);
sf::Text musicLabel("Instagram - ", monkirta, 15);
musicLabel.setPosition(mainView.getSize().x/(float)11.5, mainView.getSize().y/(float)2 + mainView.getSize().y/(float)7.3);
musicLabel.setFillColor(sf::Color::White);
sf::Text musicText0("@river.schreck", oxan, 12);
musicText0.setPosition(mainView.getSize().x/(float)11.5 + musicLabel.getGlobalBounds().width, mainView.getSize().y/(float)2 + mainView.getSize().y/(float)7.15);
musicText0.setFillColor(sf::Color::White);
musicText0.setStyle(sf::Text::Style::Underlined);
sf::Text musicLabel0("SoundCloud - ", monkirta, 15);
musicLabel0.setPosition(mainView.getSize().x/(float)11.5, mainView.getSize().y/(float)2 + mainView.getSize().y/(float)6.1);
musicLabel0.setFillColor(sf::Color::White);
sf::Text musicText1("River Ethans", oxan, 12);
musicText1.setPosition(mainView.getSize().x/(float)11.5 + musicLabel0.getGlobalBounds().width, mainView.getSize().y/(float)2 + mainView.getSize().y/(float)5.95);
musicText1.setFillColor(sf::Color::White);
musicText1.setStyle(sf::Text::Style::Underlined);
//Resources Box
sf::Text resourcesTitle("Resources", xolo, 28);
resourcesTitle.setOrigin(resourcesTitle.getGlobalBounds().width/2, resourcesTitle.getGlobalBounds().height/2);
resourcesTitle.setPosition(mainView.getSize().x - mainView.getSize().x/(float)4.95, mainView.getSize().y/(float)4.8);
resourcesTitle.setFillColor(sf::Color::White);
//Dev box
sf::Text developerTitle("Developer: ", xolo, 25);
developerTitle.setPosition(mainView.getSize().x/13, mainView.getSize().y/(float)5.2);
developerTitle.setFillColor(sf::Color(0,0,0,0));
developerTitle.setOutlineThickness(.8);
developerTitle.setOutlineColor(sf::Color::White);
sf::Text developer("Benjamin Morgan", monkirta, 20);
developer.setOrigin(developer.getGlobalBounds().width/2, developer.getGlobalBounds().height/2);
developer.setPosition(mainView.getSize().x/(float)6.725, mainView.getSize().y/(float)3.95);
developer.setFillColor(sf::Color::White);
sf::Text devLabel("Site - ", monkirta, 15);
devLabel.setPosition(mainView.getSize().x/(float)11.5, mainView.getSize().y/(float)3.65);
devLabel.setFillColor(sf::Color::White);
sf::Text devText("https://bmorgan01.github.io/Portfolio-Blog/", oxan, 12);
devText.setPosition(mainView.getSize().x/(float)11.5 + devLabel.getGlobalBounds().width, mainView.getSize().y/(float)3.6);
devText.setFillColor(sf::Color::White);
devText.setStyle(sf::Text::Style::Underlined);
sf::Text devLabel0("Github - ", monkirta, 15);
devLabel0.setPosition(mainView.getSize().x/(float)11.5, mainView.getSize().y/(float)3.35);
devLabel0.setFillColor(sf::Color::White);
sf::Text devText0("bMorgan01", oxan, 12);
devText0.setPosition(mainView.getSize().x/(float)11.5 + devLabel0.getGlobalBounds().width, mainView.getSize().y/(float)3.3);
devText0.setFillColor(sf::Color::White);
devText0.setStyle(sf::Text::Style::Underlined);
sf::Text devLabel1("Email - ", monkirta, 15);
devLabel1.setPosition(mainView.getSize().x/(float)11.5, mainView.getSize().y/(float)3.1);
devLabel1.setFillColor(sf::Color::White);
sf::Text devText1("ben.morgan5000@gmail.com", oxan, 12);
devText1.setPosition(mainView.getSize().x/(float)11.5 + devLabel1.getGlobalBounds().width, mainView.getSize().y/(float)3.05);
devText1.setFillColor(sf::Color::White);
sf::Text devLabel2("Repo - ", monkirta, 15);
devLabel2.setPosition(mainView.getSize().x/(float)11.5, mainView.getSize().y/(float)2.87);
devLabel2.setFillColor(sf::Color::White);
sf::Text devText2("https://github.com/bMorgan01/StarCap", oxan, 12);
devText2.setPosition(mainView.getSize().x/(float)11.5 + devLabel2.getGlobalBounds().width, mainView.getSize().y/(float)2.83);
devText2.setFillColor(sf::Color::White);
devText2.setStyle(sf::Text::Style::Underlined);
//Credits GUI
sf::Sprite backButton(leftArrow);
backButton.setScale(.3, .3);
backButton.setPosition(33, 100);
sf::Sprite textBox(box);
textBox.setScale(.35, .35);
textBox.setPosition(mainView.getSize().x - mainView.getSize().x/3, mainView.getSize().y/(float)5.5);
sf::Sprite textBoxSm(boxSm);
textBoxSm.setScale(.35, .35);
textBoxSm.setPosition(mainView.getSize().x/15, mainView.getSize().y/2 + mainView.getSize().y/50);
sf::Sprite devBox(cloud);
devBox.setScale(.442, .442);
devBox.setPosition(mainView.getSize().x/15 - 2, mainView.getSize().y/(float)5.5);
sf::Sprite issueButton(button);
issueButton.setColor(sf::Color::Red);
issueButton.setScale(40.0/100.0, 40.0/100.0);
issueButton.setOrigin(issueButton.getGlobalBounds().width/2, issueButton.getGlobalBounds().height/2);
issueButton.setPosition(mainView.getSize().x/(float)6.2, mainView.getSize().y/(float)2.52);
sf::Text issueText("Report Bug", sk, 16);
issueText.setPosition(issueButton.getPosition().x - 21, issueButton.getPosition().y);
issueText.setFillColor(sf::Color(0,0,0,0));
issueText.setFillColor(sf::Color::White);
credits.push_back(&creditsTitle);
credits.push_back(&developerTitle);
credits.push_back(&credsTitle);
credits.push_back(&music);
credits.push_back(&musicText);
credits.push_back(&musicLabel);
credits.push_back(&musicText0);
credits.push_back(&musicLabel0);
credits.push_back(&musicText1);
credits.push_back(&resourcesTitle);
credits.push_back(&developer);
credits.push_back(&devLabel);
credits.push_back(&devText);
credits.push_back(&devLabel0);
credits.push_back(&devText0);
credits.push_back(&devLabel1);
credits.push_back(&devText1);
credits.push_back(&devLabel2);
credits.push_back(&devText2);
credits.push_back(&issueText);
creditsGUI.push_back(&backButton);
creditsGUI.push_back(&textBox);
creditsGUI.push_back(&textBoxSm);
creditsGUI.push_back(&devBox);
creditsGUI.push_back(&issueButton);
while( window.isOpen() ) {
/*********************************************
* Pre-draw ops here.
*********************************************/
/*********************************************
* Drawing goes here.
*********************************************/
window.clear( sf::Color::Black ); // clear the contents of the old frame
window.draw(background);
switch(screen) {
case MENU:
/**************
* Draw Menu
**************/
backButton.setPosition(33, 100);
//Sound buttons
window.draw(soundButton);
window.draw(musicButton);
//Title text
window.draw(title);
for (int i = 0; i < buttons.size(); i++) {
window.draw(*buttons[i]);
window.draw(*text[i]);
}
break;
case CREDITS:
/**************
* Draw Credits
**************/
backButton.setPosition(33, 27);
for (sf::Sprite *s : creditsGUI) {
window.draw(*s);
}
for (sf::Text *t : credits) {
window.draw(*t);
}
break;
}
window.display(); // display the window
sf::Event event{};
while( window.pollEvent(event) ) { // ask the window if any events occurred
/*********************************************
* Event handling here.
*********************************************/
sf::Vector2i mousePos = sf::Mouse::getPosition( window );
sf::Vector2f mousePosF( static_cast<float>( mousePos.x ), static_cast<float>( mousePos.y ) );
switch (event.type) {
case sf::Event::Closed: //user clicked X button
window.close();
break;
case sf::Event::MouseButtonPressed: //User clicked mouse
if (exitButton.getGlobalBounds().contains(mousePosF) && screen == MENU) {
playBip();
return EXIT_FAILURE;
} else if (startButton.getGlobalBounds().contains(mousePosF) && screen == MENU) {
playBip();
return EXIT_SUCCESS;
} else if (creditsButton.getGlobalBounds().contains(mousePosF) && screen == MENU) {
playBip();
screen = CREDITS;
} else if (issueButton.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
ShellExecute(nullptr, "open", "https://github.com/bMorgan01/StarCap/issues", nullptr, nullptr, SW_SHOWNORMAL);
} else if (devText.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
ShellExecute(nullptr, "open", "https://bmorgan01.github.io/Portfolio-Blog/", nullptr, nullptr, SW_SHOWNORMAL);
} else if (devText0.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
ShellExecute(nullptr, "open", "https://github.com/bMorgan01", nullptr, nullptr, SW_SHOWNORMAL);
} else if (devText2.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
ShellExecute(nullptr, "open", "https://github.com/bMorgan01/StarCap", nullptr, nullptr, SW_SHOWNORMAL);
} else if (musicText0.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
ShellExecute(nullptr, "open", "https://www.instagram.com/river.schreck/", nullptr, nullptr, SW_SHOWNORMAL);
} else if (musicText1.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
ShellExecute(nullptr, "open", "https://soundcloud.com/riverethans", nullptr, nullptr, SW_SHOWNORMAL);
} else if (backButton.getGlobalBounds().contains(mousePosF) && screen == CREDITS) {
playBip();
screen = MENU;
} else if (soundButton.getGlobalBounds().contains(mousePosF) && screen == MENU) {
soundOn = !soundOn;
playBip();
} else if (musicButton.getGlobalBounds().contains(mousePosF) && screen == MENU) {
playBip();
musicOn = !musicOn;
if (!musicOn) menuLoop.setVolume(0);
else menuLoop.setVolume(100);
}
break;
case sf::Event::MouseMoved:
if (exitButton.getGlobalBounds().contains(mousePosF) && screen == MENU) exitButton.setColor(sf::Color::Red);
else if (startButton.getGlobalBounds().contains(mousePosF) && screen == MENU) startButton.setColor(sf::Color::Red);
else if (creditsButton.getGlobalBounds().contains(mousePosF) && screen == MENU) creditsButton.setColor(sf::Color::Red);
else if (issueButton.getGlobalBounds().contains(mousePosF) && screen == CREDITS) issueButton.setColor(sf::Color::Green);
else if (devText.getGlobalBounds().contains(mousePosF) && screen == CREDITS) devText.setFillColor(sf::Color::Red);
else if (devText0.getGlobalBounds().contains(mousePosF) && screen == CREDITS) devText0.setFillColor(sf::Color::Red);
else if (devText2.getGlobalBounds().contains(mousePosF) && screen == CREDITS) devText2.setFillColor(sf::Color::Red);
else if (musicText0.getGlobalBounds().contains(mousePosF) && screen == CREDITS) musicText0.setFillColor(sf::Color::Red);
else if (musicText1.getGlobalBounds().contains(mousePosF) && screen == CREDITS) musicText1.setFillColor(sf::Color::Red);
else if (backButton.getGlobalBounds().contains(mousePosF) && screen == CREDITS) backButton.setColor(sf::Color::Red);
else if (soundButton.getGlobalBounds().contains(mousePosF) && soundOn && screen == MENU) soundButton.setColor(sf::Color::Red);
else if (musicButton.getGlobalBounds().contains(mousePosF) && musicOn && screen == MENU) musicButton.setColor(sf::Color::Red);
else if (soundButton.getGlobalBounds().contains(mousePosF) && !soundOn && screen == MENU) soundButton.setColor(sf::Color::White);
else if (musicButton.getGlobalBounds().contains(mousePosF) && !musicOn && screen == MENU) musicButton.setColor(sf::Color::White);
break;
}
if (!exitButton.getGlobalBounds().contains(mousePosF)) exitButton.setColor(defButtonColor);
if (!startButton.getGlobalBounds().contains(mousePosF)) startButton.setColor(defButtonColor);
if (!creditsButton.getGlobalBounds().contains(mousePosF)) creditsButton.setColor(defButtonColor);
if (!issueButton.getGlobalBounds().contains(mousePosF)) issueButton.setColor(sf::Color::Red);
if (!devText.getGlobalBounds().contains(mousePosF)) devText.setFillColor(sf::Color::White);
if (!devText0.getGlobalBounds().contains(mousePosF)) devText0.setFillColor(sf::Color::White);
if (!devText2.getGlobalBounds().contains(mousePosF)) devText2.setFillColor(sf::Color::White);
if (!musicText0.getGlobalBounds().contains(mousePosF)) musicText0.setFillColor(sf::Color::White);
if (!musicText1.getGlobalBounds().contains(mousePosF)) musicText1.setFillColor(sf::Color::White);
if (!backButton.getGlobalBounds().contains(mousePosF)) backButton.setColor(defButtonColor);
if (!soundButton.getGlobalBounds().contains(mousePosF) && soundOn) soundButton.setColor(sf::Color::White);
if (!musicButton.getGlobalBounds().contains(mousePosF) && musicOn) musicButton.setColor(sf::Color::White);
if (!soundButton.getGlobalBounds().contains(mousePosF) && !soundOn) soundButton.setColor(sf::Color::Red);
if (!musicButton.getGlobalBounds().contains(mousePosF) && !musicOn) musicButton.setColor(sf::Color::Red);
}
}
return EXIT_FAILURE;
}
void Menu::playBip() {
if (soundOn) {
bipSound.setBuffer(bip);
bipSound.setVolume(100);
bipSound.play();
}
}

56
Menu.h
View file

@ -1,28 +1,28 @@
//
// Created by benmo on 2/20/2020.
//
#ifndef SFML_TEMPLATE_MENU_H
#define SFML_TEMPLATE_MENU_H
#include <SFML/Audio.hpp>
class Menu {
public:
int result;
bool soundOn = true, musicOn = true;
Menu() {
result = init();
}
private:
sf::SoundBuffer bip;
sf::Sound bipSound;
bool playedBip = false;
int init();
void playBip();
};
#endif //SFML_TEMPLATE_MENU_H
//
// Created by benmo on 2/20/2020.
//
#ifndef SFML_TEMPLATE_MENU_H
#define SFML_TEMPLATE_MENU_H
#include <SFML/Audio.hpp>
class Menu {
public:
int result;
bool soundOn = true, musicOn = true;
Menu() {
result = init();
}
private:
sf::SoundBuffer bip;
sf::Sound bipSound;
bool playedBip = false;
int init();
void playBip();
};
#endif //SFML_TEMPLATE_MENU_H

View file

@ -1,28 +1,28 @@
#include "Planet.h"
Planet::Planet(const sf::Texture &texture, float scale, float xPos, float yPos, float direction) : GameSprite(texture, scale, xPos, yPos, 0, direction) {
landable = false;
}
Planet::Planet(const std::string& _name, const std::string& _desc, int landscape, const sf::Texture &texture, float scale, float xPos, float yPos, float direction) : GameSprite(texture, scale, xPos, yPos, 0, direction) {
landable = true;
name = _name;
desc = _desc;
image = landscape;
}
bool Planet::isLandable() {
return landable;
}
std::string Planet::getName() {
return name;
}
std::string Planet::getDesc() {
return desc;
}
int Planet::getImageNum() {
return image;
#include "Planet.h"
Planet::Planet(const sf::Texture &texture, float scale, float xPos, float yPos, float direction) : GameSprite(texture, scale, xPos, yPos, 0, direction) {
landable = false;
}
Planet::Planet(const std::string& _name, const std::string& _desc, int landscape, const sf::Texture &texture, float scale, float xPos, float yPos, float direction) : GameSprite(texture, scale, xPos, yPos, 0, direction) {
landable = true;
name = _name;
desc = _desc;
image = landscape;
}
bool Planet::isLandable() {
return landable;
}
std::string Planet::getName() {
return name;
}
std::string Planet::getDesc() {
return desc;
}
int Planet::getImageNum() {
return image;
}

View file

@ -1,29 +1,29 @@
//
// Created by benmo on 3/3/2020.
//
#ifndef SFML_TEMPLATE_PLANET_H
#define SFML_TEMPLATE_PLANET_H
#include "GameSprite.h"
class Planet : public GameSprite {
private:
bool landable = true;
std::string name;
std::string desc;
int image;
public:
Planet(const sf::Texture &texture, float scale, float xPos, float yPos, float direction);
Planet(const std::string& _name, const std::string& _desc, int landscape, const sf::Texture &texture, float scale, float xPos, float yPos, float direction);
bool isLandable();
std::string getName();
std::string getDesc();
int getImageNum();
};
#endif //SFML_TEMPLATE_PLANET_H
//
// Created by benmo on 3/3/2020.
//
#ifndef SFML_TEMPLATE_PLANET_H
#define SFML_TEMPLATE_PLANET_H
#include "GameSprite.h"
class Planet : public GameSprite {
private:
bool landable = true;
std::string name;
std::string desc;
int image;
public:
Planet(const sf::Texture &texture, float scale, float xPos, float yPos, float direction);
Planet(const std::string& _name, const std::string& _desc, int landscape, const sf::Texture &texture, float scale, float xPos, float yPos, float direction);
bool isLandable();
std::string getName();
std::string getDesc();
int getImageNum();
};
#endif //SFML_TEMPLATE_PLANET_H

View file

@ -1,22 +1,22 @@
//
// Created by Benjamin on 4/20/2021.
//
#ifndef SFML_TEMPLATE_PROJECTILE_H
#define SFML_TEMPLATE_PROJECTILE_H
#include "Shootable.h"
class Projectile : public Shootable {
public:
Projectile() = default;
Projectile(const sf::Texture& texture, const sf::IntRect &rect, double scale, int rows, int cols, int xOffset, int yOffset, int frameDelay, double velocity, double damage, double _range) : Shootable(texture, rect, scale, rows, cols, xOffset, yOffset, frameDelay, damage) {
setVelocity(velocity);
lifetime = _range/velocity;
range = _range;
}
};
#endif //SFML_TEMPLATE_PROJECTILE_H
//
// Created by Benjamin on 4/20/2021.
//
#ifndef SFML_TEMPLATE_PROJECTILE_H
#define SFML_TEMPLATE_PROJECTILE_H
#include "Shootable.h"
class Projectile : public Shootable {
public:
Projectile() = default;
Projectile(const sf::Texture& texture, const sf::IntRect &rect, double scale, int rows, int cols, int xOffset, int yOffset, int frameDelay, double velocity, double damage, double _range) : Shootable(texture, rect, scale, rows, cols, xOffset, yOffset, frameDelay, damage) {
setVelocity(velocity);
lifetime = _range/velocity;
range = _range;
}
};
#endif //SFML_TEMPLATE_PROJECTILE_H

View file

@ -1,33 +1,33 @@
#include <utility>
//
// Created by Benjamin on 4/20/2021.
//
#ifndef SFML_TEMPLATE_PROJECTILEWEAPON_H
#define SFML_TEMPLATE_PROJECTILEWEAPON_H
class ProjectileWeapon : public Weapon {
public:
ProjectileWeapon(Projectile _proj, const sf::SoundBuffer& buffer, float volume, double effectiveAngle, int frameDelay) : Weapon(frameDelay, effectiveAngle, buffer, volume) {
projectile = std::move(_proj);
}
Shootable* shoot(const Ship* shooter) override {
currentFrame = 0;
noise.play();
projectile.setDirection(shooter->getDirection());
projectile.setPosition(shooter->getXPos() + shooter->getLocalBounds().width/4 * shooter->getScale().x * cos(shooter->getDirection()*GameSprite::PI/180), shooter->getYPos() - shooter->getLocalBounds().width/4 * shooter->getScale().x * sin(shooter->getDirection()*GameSprite::PI/180));
projectile.setShooter((GameSprite *) shooter);
Shootable *copied = new Shootable(projectile);
return copied;
}
};
#endif //SFML_TEMPLATE_PROJECTILEWEAPON_H
#include <utility>
//
// Created by Benjamin on 4/20/2021.
//
#ifndef SFML_TEMPLATE_PROJECTILEWEAPON_H
#define SFML_TEMPLATE_PROJECTILEWEAPON_H
class ProjectileWeapon : public Weapon {
public:
ProjectileWeapon(Projectile _proj, const sf::SoundBuffer& buffer, float volume, double effectiveAngle, int frameDelay) : Weapon(frameDelay, effectiveAngle, buffer, volume) {
projectile = std::move(_proj);
}
Shootable* shoot(const Ship* shooter) override {
currentFrame = 0;
noise.play();
projectile.setDirection(shooter->getDirection());
projectile.setPosition(shooter->getXPos() + shooter->getLocalBounds().width/4 * shooter->getScale().x * cos(shooter->getDirection()*GameSprite::PI/180), shooter->getYPos() - shooter->getLocalBounds().width/4 * shooter->getScale().x * sin(shooter->getDirection()*GameSprite::PI/180));
projectile.setShooter((GameSprite *) shooter);
Shootable *copied = new Shootable(projectile);
return copied;
}
};
#endif //SFML_TEMPLATE_PROJECTILEWEAPON_H

29
Rider.h Normal file
View file

@ -0,0 +1,29 @@
//
// Created by Benjamin on 4/29/2021.
//
#ifndef SFML_TEMPLATE_RIDER_H
#define SFML_TEMPLATE_RIDER_H
class Rider : public GameSprite {
private:
GameSprite *mount;
sf::Vector2f relativeLoc;
public:
Rider(const sf::Texture &texture, float scale, GameSprite *_mount, sf::Vector2f worldCoord) : GameSprite(texture, scale) {
mount = _mount;
relativeLoc = sf::Vector2f(worldCoord.x - mount->getPosition().x, worldCoord.y - mount->getPosition().y);
relativeLoc = mount->getInverseTransform().transformPoint(relativeLoc);
}
void update() override {
sf::Vector2f newLoc = mount->getTransform().transformPoint(relativeLoc);
setPosition(newLoc);
GameSprite::update();
}
};
#endif //SFML_TEMPLATE_RIDER_H

218
Ship.cpp
View file

@ -1,109 +1,109 @@
//
// Created by benmo on 2/16/2020.
//
#include "Ship.h"
Ship::Ship(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction, float turnSpeed, int maxFuel, int maxHull, int cargo, int passengers) : GameSprite(texture, scale, round(xPos), round(yPos), velocity, maxVelocity, direction) {
turnRate = turnSpeed;
fullScale = scale;
fuelCap = maxFuel;
fuel = maxFuel;
hullCap = maxHull;
hull = hullCap;
cargoSpace = cargo;
passengerSpace = passengers;
target = nullptr;
}
void Ship::update() {
for (Weapon *w : weapons) {
w->recharge();
}
GameSprite::update();
}
void Ship::shoot(std::vector<Shootable*> &shots) {
for (Weapon *w : weapons) {
if (w->canShoot()) {
shots.push_back(w->shoot(this));
}
}
}
float Ship::getTurnRate() const {
return turnRate;
}
float Ship::getFullScale () const {
return fullScale;
}
int Ship::getFuelCap() const {
return fuelCap;
}
int Ship::getFuelRemaining() const {
return fuel;
}
void Ship::useFuel() {
fuel--;
}
void Ship::setFuel(int _fuel) {
fuel = _fuel;
}
int Ship::getHullCap() const {
return hullCap;
}
int Ship::getHullRemaining() const {
return hull;
}
void Ship::setHull(int _hull) {
hull = _hull;
}
int Ship::getCargoSpace() const {
return cargoSpace;
}
int Ship::getUsedCargoSpace() const {
return cargoUsed;
}
void Ship::setUsedCargoSpace(int _cargoUsed) {
cargoUsed = _cargoUsed;
}
int Ship::getPassengerSpace() const {
return passengerSpace;
}
int Ship::getPassengersAboard() const {
return passengersOn;
}
void Ship::setPassengersAboard(int _passengersOn) {
passengersOn = _passengersOn;
}
Ship * Ship::getTarget() const {
return target;
}
void Ship::setTarget(Ship *_target) {
target = _target;
}
void Ship::addWeapon(Weapon *w) {
weapons.push_back(w);
}
//
// Created by benmo on 2/16/2020.
//
#include "Ship.h"
Ship::Ship(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction, float turnSpeed, int maxFuel, int maxHull, int cargo, int passengers) : GameSprite(texture, scale, round(xPos), round(yPos), velocity, maxVelocity, direction) {
turnRate = turnSpeed;
fullScale = scale;
fuelCap = maxFuel;
fuel = maxFuel;
hullCap = maxHull;
hull = hullCap;
cargoSpace = cargo;
passengerSpace = passengers;
target = nullptr;
}
void Ship::update() {
for (Weapon *w : weapons) {
w->recharge();
}
GameSprite::update();
}
void Ship::shoot(std::vector<Shootable*> &shots) {
for (Weapon *w : weapons) {
if (w->canShoot()) {
shots.push_back(w->shoot(this));
}
}
}
float Ship::getTurnRate() const {
return turnRate;
}
float Ship::getFullScale () const {
return fullScale;
}
int Ship::getFuelCap() const {
return fuelCap;
}
int Ship::getFuelRemaining() const {
return fuel;
}
void Ship::useFuel() {
fuel--;
}
void Ship::setFuel(int _fuel) {
fuel = _fuel;
}
int Ship::getHullCap() const {
return hullCap;
}
int Ship::getHullRemaining() const {
return hull;
}
void Ship::setHull(int _hull) {
hull = _hull;
}
int Ship::getCargoSpace() const {
return cargoSpace;
}
int Ship::getUsedCargoSpace() const {
return cargoUsed;
}
void Ship::setUsedCargoSpace(int _cargoUsed) {
cargoUsed = _cargoUsed;
}
int Ship::getPassengerSpace() const {
return passengerSpace;
}
int Ship::getPassengersAboard() const {
return passengersOn;
}
void Ship::setPassengersAboard(int _passengersOn) {
passengersOn = _passengersOn;
}
Ship * Ship::getTarget() const {
return target;
}
void Ship::setTarget(Ship *_target) {
target = _target;
}
void Ship::addWeapon(Weapon *w) {
weapons.push_back(w);
}

114
Ship.h
View file

@ -1,57 +1,57 @@
//
// Created by benmo on 2/16/2020.
//
#ifndef SFML_TEMPLATE_SHIP_H
#define SFML_TEMPLATE_SHIP_H
#include <vector>
#include <SFML/Graphics/Texture.hpp>
#include "GameSprite.h"
#include "Weapon.h"
class Ship : public GameSprite {
protected:
float fullScale, turnRate;
int fuelCap, fuel, hullCap, hull, cargoSpace, cargoUsed = 0, passengerSpace, passengersOn = 0;
std::vector<Weapon*> weapons;
Ship *target;
public:
Ship(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction, float turnSpeed, int maxFuel, int maxHull, int cargo, int passengers);
void update();
virtual void shoot(std::vector<Shootable*> &projectiles);
float getTurnRate() const;
float getFullScale () const;
int getFuelCap() const;
int getFuelRemaining() const;
void useFuel();
void setFuel(int);
int getHullCap() const;
int getHullRemaining() const;
void setHull(int _hull);
int getCargoSpace() const;
int getUsedCargoSpace() const;
void setUsedCargoSpace(int _cargoUsed);
int getPassengerSpace() const;
int getPassengersAboard() const;
void setPassengersAboard(int _passengersOn);
Ship * getTarget() const;
void setTarget(Ship *_target);
void addWeapon(Weapon *w);
};
#endif //SFML_TEMPLATE_SHIP_H
//
// Created by benmo on 2/16/2020.
//
#ifndef SFML_TEMPLATE_SHIP_H
#define SFML_TEMPLATE_SHIP_H
#include <vector>
#include <SFML/Graphics/Texture.hpp>
#include "GameSprite.h"
#include "Weapon.h"
class Ship : public GameSprite {
protected:
float fullScale, turnRate;
int fuelCap, fuel, hullCap, hull, cargoSpace, cargoUsed = 0, passengerSpace, passengersOn = 0;
std::vector<Weapon*> weapons;
Ship *target;
public:
Ship(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction, float turnSpeed, int maxFuel, int maxHull, int cargo, int passengers);
void update();
virtual void shoot(std::vector<Shootable*> &projectiles);
float getTurnRate() const;
float getFullScale () const;
int getFuelCap() const;
int getFuelRemaining() const;
void useFuel();
void setFuel(int);
int getHullCap() const;
int getHullRemaining() const;
void setHull(int _hull);
int getCargoSpace() const;
int getUsedCargoSpace() const;
void setUsedCargoSpace(int _cargoUsed);
int getPassengerSpace() const;
int getPassengersAboard() const;
void setPassengersAboard(int _passengersOn);
Ship * getTarget() const;
void setTarget(Ship *_target);
void addWeapon(Weapon *w);
};
#endif //SFML_TEMPLATE_SHIP_H

View file

@ -1,47 +1,47 @@
//
// Created by Benjamin on 4/20/2021.
//
#ifndef SFML_TEMPLATE_SHOOTABLE_H
#define SFML_TEMPLATE_SHOOTABLE_H
#include "GameSprite.h"
#include "Ship.h"
class Ship;
class Shootable : public GameSprite {
protected:
double damage;
double range = 0;
Ship *shooter;
protected:
Shootable(const sf::Texture& texture, const sf::IntRect &rect, double scale, int rows, int cols, int xOffset, int yOffset, int frameDelay, double _damage) : GameSprite(texture, rect, rows, cols, xOffset, yOffset, frameDelay) {
damage = _damage;
setScale(scale/100, scale/100);
}
public:
Shootable() = default;
void setShooter(GameSprite* _shooter) {
shooter = reinterpret_cast<Ship *>(_shooter);
}
Ship* getShooter() {
return shooter;
}
double getDamage() const {
return damage;
}
double getRange() const {
return range;
}
};
#endif //SFML_TEMPLATE_SHOOTABLE_H
//
// Created by Benjamin on 4/20/2021.
//
#ifndef SFML_TEMPLATE_SHOOTABLE_H
#define SFML_TEMPLATE_SHOOTABLE_H
#include "GameSprite.h"
#include "Ship.h"
class Ship;
class Shootable : public GameSprite {
protected:
double damage;
double range = 0;
Ship *shooter;
protected:
Shootable(const sf::Texture& texture, const sf::IntRect &rect, double scale, int rows, int cols, int xOffset, int yOffset, int frameDelay, double _damage) : GameSprite(texture, rect, rows, cols, xOffset, yOffset, frameDelay) {
damage = _damage;
setScale(scale/100, scale/100);
}
public:
Shootable() = default;
void setShooter(GameSprite* _shooter) {
shooter = reinterpret_cast<Ship *>(_shooter);
}
Ship* getShooter() {
return shooter;
}
double getDamage() const {
return damage;
}
double getRange() const {
return range;
}
};
#endif //SFML_TEMPLATE_SHOOTABLE_H

View file

@ -1,94 +1,94 @@
#include "System.h"
System::System(std::string _name) {
name = std::move(_name);
}
sf::Sprite* System::getSystemCenter() {
return planets[1];
}
void System::addPlanet(Planet *p) {
planets.push_back(p);
if (p->isLandable()) landable = true;
}
void System::setRelativeMapPos(const sf::Vector2f &pos) {
mapPos = pos;
}
sf::Vector2f System::getRelativeMapPos() {
return mapPos;
}
void System::makeVisited() {
visited = true;
}
bool System::isVisited() const {
return visited;
}
std::string System::getName() {
return name;
}
void System::setGovName(std::string gov) {
govName = std::move(gov);
}
std::string System::getGovName() {
return govName;
}
void System::setSysRep(int _rep) {
rep = _rep;
}
int System::getSysRep() const {
return rep;
}
void System::setPop(int _pop) {
pop = _pop;
}
int System::getPop() const {
return pop;
}
void System::setStren(int _stren) {
stren = _stren;
}
int System::getStren() const {
return stren;
}
bool System::isLandable() const {
return landable;
}
const std::vector<Planet *> &System::getPlanets() const {
return planets;
}
void System::setPlanets(const std::vector<Planet *> &planetList) {
System::planets = planetList;
}
std::vector<Task *> &System::getTasks(){
return tasks;
}
const std::vector<int> &System::getExits() const {
return exits;
}
void System::addExit(int exit) {
exits.push_back(exit);
}
void System::addTask(Task *task) {
tasks.push_back(task);
}
#include "System.h"
System::System(std::string _name) {
name = std::move(_name);
}
sf::Sprite* System::getSystemCenter() {
return planets[1];
}
void System::addPlanet(Planet *p) {
planets.push_back(p);
if (p->isLandable()) landable = true;
}
void System::setRelativeMapPos(const sf::Vector2f &pos) {
mapPos = pos;
}
sf::Vector2f System::getRelativeMapPos() {
return mapPos;
}
void System::makeVisited() {
visited = true;
}
bool System::isVisited() const {
return visited;
}
std::string System::getName() {
return name;
}
void System::setGovName(std::string gov) {
govName = std::move(gov);
}
std::string System::getGovName() {
return govName;
}
void System::setSysRep(int _rep) {
rep = _rep;
}
int System::getSysRep() const {
return rep;
}
void System::setPop(int _pop) {
pop = _pop;
}
int System::getPop() const {
return pop;
}
void System::setStren(int _stren) {
stren = _stren;
}
int System::getStren() const {
return stren;
}
bool System::isLandable() const {
return landable;
}
const std::vector<Planet *> &System::getPlanets() const {
return planets;
}
void System::setPlanets(const std::vector<Planet *> &planetList) {
System::planets = planetList;
}
std::vector<Task *> &System::getTasks(){
return tasks;
}
const std::vector<int> &System::getExits() const {
return exits;
}
void System::addExit(int exit) {
exits.push_back(exit);
}
void System::addTask(Task *task) {
tasks.push_back(task);
}

140
System.h
View file

@ -1,70 +1,70 @@
//
// Created by benmo on 2/24/2020.
//
#ifndef SFML_TEMPLATE_SYSTEM_H
#define SFML_TEMPLATE_SYSTEM_H
#include <utility>
#include <vector>
#include <string>
#include "Planet.h"
#include "Task.h"
class System {
private:
std::string name;
std::string govName;
sf::Vector2f mapPos;
bool visited = false;
bool landable = false;
int rep = 5;
int pop = 0;
int stren = 0;
std::vector<Planet*> planets;
std::vector<Task*> tasks;
std::vector<int> exits;
public:
explicit System(std::string _name);
sf::Sprite* getSystemCenter();
void addPlanet(Planet *p);
void setRelativeMapPos(const sf::Vector2f &pos);
sf::Vector2f getRelativeMapPos();
void makeVisited();
bool isVisited() const;
std::string getName();
void setGovName(std::string gov);
std::string getGovName();
void setSysRep(int _rep);
int getSysRep() const;
void setPop(int _pop);
int getPop() const;
void setStren(int _stren);
int getStren() const;
bool isLandable() const;
const std::vector<Planet *> &getPlanets() const;
void setPlanets(const std::vector<Planet *> &planetList);
std::vector<Task *> &getTasks();
void addTask(Task* task);
const std::vector<int> &getExits() const;
void addExit(int exit);
};
#endif //SFML_TEMPLATE_SYSTEM_H
//
// Created by benmo on 2/24/2020.
//
#ifndef SFML_TEMPLATE_SYSTEM_H
#define SFML_TEMPLATE_SYSTEM_H
#include <utility>
#include <vector>
#include <string>
#include "Planet.h"
#include "Task.h"
class System {
private:
std::string name;
std::string govName;
sf::Vector2f mapPos;
bool visited = false;
bool landable = false;
int rep = 5;
int pop = 0;
int stren = 0;
std::vector<Planet*> planets;
std::vector<Task*> tasks;
std::vector<int> exits;
public:
explicit System(std::string _name);
sf::Sprite* getSystemCenter();
void addPlanet(Planet *p);
void setRelativeMapPos(const sf::Vector2f &pos);
sf::Vector2f getRelativeMapPos();
void makeVisited();
bool isVisited() const;
std::string getName();
void setGovName(std::string gov);
std::string getGovName();
void setSysRep(int _rep);
int getSysRep() const;
void setPop(int _pop);
int getPop() const;
void setStren(int _stren);
int getStren() const;
bool isLandable() const;
const std::vector<Planet *> &getPlanets() const;
void setPlanets(const std::vector<Planet *> &planetList);
std::vector<Task *> &getTasks();
void addTask(Task* task);
const std::vector<int> &getExits() const;
void addExit(int exit);
};
#endif //SFML_TEMPLATE_SYSTEM_H

110
Task.h
View file

@ -1,55 +1,55 @@
//
// Created by benmo on 3/19/2020.
//
#ifndef SFML_TEMPLATE_TASK_H
#define SFML_TEMPLATE_TASK_H
#include <string>
#include "Planet.h"
class System;
class Task {
private:
std::string name, desc;
int type, size, reward;
System *sysLoc;
Planet *loc;
public:
static const int DELIVERY = 0, TAXI = 1;
Task(int _type, const std::string& _name, const std::string& _desc, System *_sysLoc, Planet *_loc, int _reward, int _size) {
type = _type;
name = _name;
desc = _desc;
reward = _reward;
size = _size;
sysLoc = _sysLoc;
loc = _loc;
}
int getType() const {
return type;
}
int getReward() const {
return reward;
}
int getSize() const {
return size;
}
System* getSystem() {
return sysLoc;
}
Planet* getPlanet() {
return loc;
}
};
#endif //SFML_TEMPLATE_TASK_H
//
// Created by benmo on 3/19/2020.
//
#ifndef SFML_TEMPLATE_TASK_H
#define SFML_TEMPLATE_TASK_H
#include <string>
#include "Planet.h"
class System;
class Task {
private:
std::string name, desc;
int type, size, reward;
System *sysLoc;
Planet *loc;
public:
static const int DELIVERY = 0, TAXI = 1;
Task(int _type, const std::string& _name, const std::string& _desc, System *_sysLoc, Planet *_loc, int _reward, int _size) {
type = _type;
name = _name;
desc = _desc;
reward = _reward;
size = _size;
sysLoc = _sysLoc;
loc = _loc;
}
int getType() const {
return type;
}
int getReward() const {
return reward;
}
int getSize() const {
return size;
}
System* getSystem() {
return sysLoc;
}
Planet* getPlanet() {
return loc;
}
};
#endif //SFML_TEMPLATE_TASK_H

116
Weapon.h
View file

@ -1,58 +1,58 @@
//
// Created by Benjamin on 4/20/2021.
//
#ifndef SFML_TEMPLATE_WEAPON_H
#define SFML_TEMPLATE_WEAPON_H
#include "Projectile.h"
#include "GameSprite.h"
#include <SFML/Audio.hpp>
#include <iostream>
class Weapon {
protected:
int frameDelay, currentFrame;
Shootable projectile;
sf::Sound noise;
double effectiveAngle;
Weapon() {
frameDelay = 0;
currentFrame = 0;
projectile = Shootable();
};
explicit Weapon(int _frameDelay, double _effectiveAngle, const sf::SoundBuffer& _buffer, float volume) : Weapon() {
effectiveAngle = _effectiveAngle;
frameDelay = _frameDelay;
noise.setBuffer(_buffer);
noise.setVolume(volume);
}
public:
virtual Shootable* shoot(const Ship* shooter) {
return new Shootable(projectile);
}
void recharge() {
if (currentFrame < frameDelay) {
currentFrame++;
}
}
bool canShoot() const {
return currentFrame == frameDelay;
}
Shootable& getProjectile() {
return projectile;
}
double getEffectiveAngle() const {
return effectiveAngle;
}
};
#endif //SFML_TEMPLATE_WEAPON_H
//
// Created by Benjamin on 4/20/2021.
//
#ifndef SFML_TEMPLATE_WEAPON_H
#define SFML_TEMPLATE_WEAPON_H
#include "Projectile.h"
#include "GameSprite.h"
#include <SFML/Audio.hpp>
#include <iostream>
class Weapon {
protected:
int frameDelay, currentFrame;
Shootable projectile;
sf::Sound noise;
double effectiveAngle;
Weapon() {
frameDelay = 0;
currentFrame = 0;
projectile = Shootable();
};
explicit Weapon(int _frameDelay, double _effectiveAngle, const sf::SoundBuffer& _buffer, float volume) : Weapon() {
effectiveAngle = _effectiveAngle;
frameDelay = _frameDelay;
noise.setBuffer(_buffer);
noise.setVolume(volume);
}
public:
virtual Shootable* shoot(const Ship* shooter) {
return new Shootable(projectile);
}
void recharge() {
if (currentFrame < frameDelay) {
currentFrame++;
}
}
bool canShoot() const {
return currentFrame == frameDelay;
}
Shootable& getProjectile() {
return projectile;
}
double getEffectiveAngle() const {
return effectiveAngle;
}
};
#endif //SFML_TEMPLATE_WEAPON_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

View file

@ -1,101 +1,101 @@
Jade
Rain
Dominion
Leviathan
Salvation
Fate
Change
Sorrow
Glass
Crystal
Heaven
Sand
Moonlight
Dawn
Dusk
Mystery
Magic
Fire
Ice
Water
Starlight
Lightning
Thunder
Steel
Glory
Stone
Bravery
Poetry
Promise
Beauty
Mirth
Olympus
Light
Charity
Mercy
Hope
Virtue
Fortitude
Enlightenment
Might
Destiny
Grass
Clarity
Serenity
Tranquility
Paradise
Contentment
Strength
Power
Salt
Atlantis
Herring
Doubt
Flint
Spring
Summer
Autumn
Winter
Snow
Time
Space
Paper
Rice
Wheat
Bread
Cheddar
Motion
Ash
Sagebrush
Lead
Tin
Copper
Bronze
Brass
Silver
Gold
Cloth
Junk
Logic
Silence
Wine
Money
Slate
Graphite
Cobalt
Platinum
Wood
Ore
Grain
Fission
Fusion
Life
Hair
Smoke
Essence
Clay
Myth
Victory
Defiance
Borneo
Jade
Rain
Dominion
Leviathan
Salvation
Fate
Change
Sorrow
Glass
Crystal
Heaven
Sand
Moonlight
Dawn
Dusk
Mystery
Magic
Fire
Ice
Water
Starlight
Lightning
Thunder
Steel
Glory
Stone
Bravery
Poetry
Promise
Beauty
Mirth
Olympus
Light
Charity
Mercy
Hope
Virtue
Fortitude
Enlightenment
Might
Destiny
Grass
Clarity
Serenity
Tranquility
Paradise
Contentment
Strength
Power
Salt
Atlantis
Herring
Doubt
Flint
Spring
Summer
Autumn
Winter
Snow
Time
Space
Paper
Rice
Wheat
Bread
Cheddar
Motion
Ash
Sagebrush
Lead
Tin
Copper
Bronze
Brass
Silver
Gold
Cloth
Junk
Logic
Silence
Wine
Money
Slate
Graphite
Cobalt
Platinum
Wood
Ore
Grain
Fission
Fusion
Life
Hair
Smoke
Essence
Clay
Myth
Victory
Defiance
Borneo
Grace

View file

@ -1,298 +1,298 @@
Abundant
Accurate
Addicted
Adorable
Adventurous
Afraid
Aggressive
Alcoholic
Alert
Aloof
Ambitious
Ancient
Angry
Animated
Annoying
Anxious
Arrogant
Ashamed
Attractive
Auspicious
Awesome
Awful
Abactinal
Abandoned
Abashed
Abatable
Abatic
Abaxial
Abbatial
Abbreviated
Abducent
Abducting
Aberrant
Abeyant
Abhorrent
Abiding
Abient
Bad
Bashful
Beautiful
Belligerent
Beneficial
Best
Big
Bitter
Bizarre
Black
Blue
Boring
Brainy
Bright
Broad
Broken
Busy
Barren
Barricaded
Barytic
Basal
Basaltic
Baseborn
Based
Baseless
Basic
Bathyal
Battleful
Battlemented
Batty
Batwing
Bias
Calm
Capable
Careful
Careless
Caring
Cautious
Charming
Cheap
Cheerful
Chubby
Clean
Clever
Clumsy
Cold
Colorful
Comfortable
Concerned
Confused
Crowded
Cruel
Curious
Curly
Cute
Damaged
Dangerous
Dark
Deep
Defective
Delicate
Delicious
Depressed
Determined
Different
Dirty
Disgusting
Dry
Dusty
Daft
Daily
Dainty
Damn
Damning
Damp
Dampish
Darkling
Darned
Dauntless
Daylong
Early
Educated
Efficient
Elderly
Elegant
Embarrassed
Empty
Encouraging
Enthusiastic
Excellent
Exciting
Expensive
Fabulous
Fair
Faithful
Famous
Fancy
Fantastic
Fast
Fearful
Fearless
Fertile
Filthy
Foolish
Forgetful
Friendly
Funny
Gentle
Glamorous
Glorious
Gorgeous
Graceful
Grateful
Great
Greedy
Green
Handsome
Happy
Harsh
Healthy
Heavy
Helpful
Hilarious
Historical
Horrible
Hot
Huge
Humorous
Hungry
Ignorant
Illegal
Imaginary
Impolite
Important
Impossible
Innocent
Intelligent
Interesting
Jealous
Jolly
Juicy
Juvenile
Kind
Large
Legal
Light
Literate
Little
Lively
Lonely
Loud
Lovely
Lucky
Macho
Magical
Magnificent
Massive
Mature
Mean
Messy
Modern
Narrow
Nasty
Naughty
Nervous
New
Noisy
Nutritious
Obedient
Obese
Obnoxious
Old
Overconfident
Peaceful
Pink
Polite
Poor
Powerful
Precious
Pretty
Proud
Quick
Quiet
Rapid
Rare
Red
Remarkable
Responsible
Rich
Romantic
Royal
Rude
Scintillating
Secretive
Selfish
Serious
Sharp
Shiny
Shocking
Short
Shy
Silly
Sincere
Skinny
Slim
Slow
Small
Soft
Spicy
Spiritual
Splendid
Strong
Successful
Sweet
Talented
Tall
Tense
Terrible
Terrific
Thick
Thin
Tiny
Tactful
Tailor-made
Take-charge
Tangible
Tasteful
Tasty
Teachable
Teeming
Tempean
Temperate
Tenable
Tenacious
Tender
Tender-hearted
Terrific
Testimonial
Thankful
Thankworthy
Therapeutic
Thorough
Thoughtful
Ugly
Unique
Untidy
Upset
Victorious
Violent
Vulgar
Warm
Weak
Wealthy
Wide
Wise
Witty
Wonderful
Worried
Young
Youthful
Abundant
Accurate
Addicted
Adorable
Adventurous
Afraid
Aggressive
Alcoholic
Alert
Aloof
Ambitious
Ancient
Angry
Animated
Annoying
Anxious
Arrogant
Ashamed
Attractive
Auspicious
Awesome
Awful
Abactinal
Abandoned
Abashed
Abatable
Abatic
Abaxial
Abbatial
Abbreviated
Abducent
Abducting
Aberrant
Abeyant
Abhorrent
Abiding
Abient
Bad
Bashful
Beautiful
Belligerent
Beneficial
Best
Big
Bitter
Bizarre
Black
Blue
Boring
Brainy
Bright
Broad
Broken
Busy
Barren
Barricaded
Barytic
Basal
Basaltic
Baseborn
Based
Baseless
Basic
Bathyal
Battleful
Battlemented
Batty
Batwing
Bias
Calm
Capable
Careful
Careless
Caring
Cautious
Charming
Cheap
Cheerful
Chubby
Clean
Clever
Clumsy
Cold
Colorful
Comfortable
Concerned
Confused
Crowded
Cruel
Curious
Curly
Cute
Damaged
Dangerous
Dark
Deep
Defective
Delicate
Delicious
Depressed
Determined
Different
Dirty
Disgusting
Dry
Dusty
Daft
Daily
Dainty
Damn
Damning
Damp
Dampish
Darkling
Darned
Dauntless
Daylong
Early
Educated
Efficient
Elderly
Elegant
Embarrassed
Empty
Encouraging
Enthusiastic
Excellent
Exciting
Expensive
Fabulous
Fair
Faithful
Famous
Fancy
Fantastic
Fast
Fearful
Fearless
Fertile
Filthy
Foolish
Forgetful
Friendly
Funny
Gentle
Glamorous
Glorious
Gorgeous
Graceful
Grateful
Great
Greedy
Green
Handsome
Happy
Harsh
Healthy
Heavy
Helpful
Hilarious
Historical
Horrible
Hot
Huge
Humorous
Hungry
Ignorant
Illegal
Imaginary
Impolite
Important
Impossible
Innocent
Intelligent
Interesting
Jealous
Jolly
Juicy
Juvenile
Kind
Large
Legal
Light
Literate
Little
Lively
Lonely
Loud
Lovely
Lucky
Macho
Magical
Magnificent
Massive
Mature
Mean
Messy
Modern
Narrow
Nasty
Naughty
Nervous
New
Noisy
Nutritious
Obedient
Obese
Obnoxious
Old
Overconfident
Peaceful
Pink
Polite
Poor
Powerful
Precious
Pretty
Proud
Quick
Quiet
Rapid
Rare
Red
Remarkable
Responsible
Rich
Romantic
Royal
Rude
Scintillating
Secretive
Selfish
Serious
Sharp
Shiny
Shocking
Short
Shy
Silly
Sincere
Skinny
Slim
Slow
Small
Soft
Spicy
Spiritual
Splendid
Strong
Successful
Sweet
Talented
Tall
Tense
Terrible
Terrific
Thick
Thin
Tiny
Tactful
Tailor-made
Take-charge
Tangible
Tasteful
Tasty
Teachable
Teeming
Tempean
Temperate
Tenable
Tenacious
Tender
Tender-hearted
Terrific
Testimonial
Thankful
Thankworthy
Therapeutic
Thorough
Thoughtful
Ugly
Unique
Untidy
Upset
Victorious
Violent
Vulgar
Warm
Weak
Wealthy
Wide
Wise
Witty
Wonderful
Worried
Young
Youthful
Zealous

View file

@ -1,143 +1,143 @@
Aardvark
Alligator
Alpaca
Anaconda
Ant
Antelope
Ape
Aphid
Armadillo
Asp
Ass
Baboon
Badger
Bald Eagle
Barracuda
Bass
Basset Hound
Bat
Bear
Beaver
Bedbug
Bee
Beetle
Bird
Bison
Bobcat
Buffalo
Butterfly
Buzzard
Camel
Caribou
Carp
Cat
Caterpillar
Catfish
Cheetah
Chicken
Chimpanzee
Chipmunk
Cobra
Cod
Condor
Cougar
Cow
Coyote
Crab
Crane
Cricket
Crocodile
Crow
Cuckoo
Deer
Dinosaur
Dog
Dolphin
Donkey
Dove
Dragonfly
Duck
Eagle
Eel
Elephant
Emu
Falcon
Ferret
Finch
Fish
Flamingo
Flea
Fly
Fox
Frog
Goat
Goose
Gopher
Gorilla
Grasshopper
Hamster
Hare
Hawk
Hippopotamus
Horse
Hummingbird
Humpback Whale
Husky
Iguana
Impala
Kangaroo
Ladybug
Leopard
Lion
Lizard
Llama
Lobster
Mongoose
Monitor lizard
Monkey
Moose
Mosquito
Moth
Mountain goat
Mouse
Mule
Octopus
Orca
Ostrich
Otter
Owl
Ox
Oyster
Panda
Panther
Parrot
Peacock
Pelican
Penguin
Perch
Pheasant
Pig
Pigeon
Polar bear
Porcupine
Quail
Rabbit
Raccoon
Rat
Rattlesnake
Raven
Rooster
Sea lion
Sheep
Shrew
Skunk
Snail
Snake
Spider
Spider
Tiger
Walrus
Whale
Whale
Wolf
Aardvark
Alligator
Alpaca
Anaconda
Ant
Antelope
Ape
Aphid
Armadillo
Asp
Ass
Baboon
Badger
Bald Eagle
Barracuda
Bass
Basset Hound
Bat
Bear
Beaver
Bedbug
Bee
Beetle
Bird
Bison
Bobcat
Buffalo
Butterfly
Buzzard
Camel
Caribou
Carp
Cat
Caterpillar
Catfish
Cheetah
Chicken
Chimpanzee
Chipmunk
Cobra
Cod
Condor
Cougar
Cow
Coyote
Crab
Crane
Cricket
Crocodile
Crow
Cuckoo
Deer
Dinosaur
Dog
Dolphin
Donkey
Dove
Dragonfly
Duck
Eagle
Eel
Elephant
Emu
Falcon
Ferret
Finch
Fish
Flamingo
Flea
Fly
Fox
Frog
Goat
Goose
Gopher
Gorilla
Grasshopper
Hamster
Hare
Hawk
Hippopotamus
Horse
Hummingbird
Humpback Whale
Husky
Iguana
Impala
Kangaroo
Ladybug
Leopard
Lion
Lizard
Llama
Lobster
Mongoose
Monitor lizard
Monkey
Moose
Mosquito
Moth
Mountain goat
Mouse
Mule
Octopus
Orca
Ostrich
Otter
Owl
Ox
Oyster
Panda
Panther
Parrot
Peacock
Pelican
Penguin
Perch
Pheasant
Pig
Pigeon
Polar bear
Porcupine
Quail
Rabbit
Raccoon
Rat
Rattlesnake
Raven
Rooster
Sea lion
Sheep
Shrew
Skunk
Snail
Snake
Spider
Spider
Tiger
Walrus
Whale
Whale
Wolf
Zebra

View file

@ -1,490 +1,490 @@
Horizon
Enterprise
Rabbit
Napoleon
Khagan
Yokozuna
Ozeki
Black Bear
Indefatigable
Dauntless
Nautilus
Dolphin
Humboldt
Eagle
Slipstream
Stargazer
Venture
Union
Sunrise
Laotzu
Mencius
Hawk
Confucius
Megalith
Istanbul
Constantinople
Winchester
Magellan
Constellation
Orion
Oracle
Promised Land
Garden of Eden
George Washington
Odysseus
Poseidon
Sinbad
Falling Snow
Quetzal
Quetzlcoatl
Icebreaker
Gorgon
Winston Churchill
Saint Felix
Orca
Snowy Owl
Bombay
Arethusa
Crown Point
Botany Bay
Medway
Allure
Bazinje
Nomad
Redoubtable
Primarch
Great Egret
Jeanne d'Arc
Geronimo
Sitting Bull
Pocahontas
Crazy Horse
Toreador
Chelmsford
Argo
Golden Fleece
Pequod
Beagle
Santa Maria
Bismark
Golden Hind
Mayflower
Monitor
Merrimack
Potemkin
Yamato
Fujiyama
Pretoria
Xiao Yi
Lou Chuan
Zheng He
Baychimo
Constitution
Excelsior
Renaissance
Yellowstone
Jim Jones
John Henry
Paul Bunyan
Robin Hood
Annie Oakley
Emiliano Zapata
North Star
Wanderer
Tears in Rain
Happy Returns
No Gods, No Masters
Majestic
Santa Fe
Hunk of Junk
Bucket of Bolts
Slag Heap
Flying Junkyard
Hammerhead
Heliopolis
Cornwall
Chichen Itza
Small Potatoes
Simon Bolivar
Spartacus
Harriet Tubman
Stonewall Jackson
Shaka Zulu
Silk Road
Good Egg
Terrible Swift Sword
Loaves and Fishes
Hero of Old
Ties That Bind
A Quiet Truth
Fantastic Planet
Observer
Times of Woe
Henry Ford
Charles de Gaulle
Circe
Amelia Earhart
Charles Lindbergh
Roald Dahl
Larry the Ship
Jim Bowie
Pax Republica
Riga
Yerevan
Brasilia
Cape Town
Borealis
Narcissus
Tea Clipper
Close-Hauled
Windjammer
Windstar
Potosi
Minotaur
Ouroboros
Tiamat
Artemis
Annabel Lee
Old Ironsides
Spice of Life
Purifying Gaze
Chateau Gaillard
Sacramento
Labnathia
Brick by Brick
Murano
Johannesburg
Stapleton
Righteous
Venerable
Mjolnir
Starscreamer
Barrabas
Musashi
Misaka
Belo Horizonte
Visby
Pyotr Velikiy
Invincible
Renowned
Courageous
Indomitable
Endurance
Avenger
Unrivaled
Retribution
Allegiance
One Hand Clapping
Washed Away
Cash is King
Equality
Equanimity
Eudamonia
Independence
Interdependence
Mutuality
Proteus
William Rockefeller
Lewis and Clark
Leif Erikson
Marco Polo
Zheng He
Vasco de Gama
Amerigo Vespucci
Jacques Cartier
James Cook
Horatio Hornblower
Thorstein Veblen
Karl Marx
John Maynard Keynes
Milton Friedman
Missouri
Montana
Essex
Karaboudjan
Immer Essen
Scotia
Sherwood
Thunderfish
Venture
Arabella
Baalbek
Barracuda
Bellipotent
Calypso
Forrestal
Compass Rose
Covenant
Dazzler
Fenton
Keeling
Marie Celeste
Hodgson
Okinawa
Orcus
Pharaoh
Pyramus
Reluctant
Saltash
Sturgeon
Swordfish
Seaview
Starview
Umbriago
Valparaiso
Kandahar
Colonia
Shenandoah
Destiny
Rockingham
Atropos
Hotspur
Speedwell
Sutherland
Magicienne
Papillion
Vestal
Remembrance
Ark
Sardine
Pinafore
Minnow
Skydiver
Vondel
Elisabeth Dane
Valkyrie
Geofon
Beowulf
Nunki
Mercury
Venus
Mars
Jupiter
Saturn
Uranus
Neptune
Pluto
Aquarius
Pisces
Aries
Taurus
Gemini
Leo
Virgo
Libra
Scorpio
Sagittarius
Capricorn
Karkinos
Krios
Tavros
Didimoi
Leon
Parthenos
Zygos
Skorpios
Toksotis
Aigokeros
Ydrohoos
Ihtheis
Ophiuchus
Saman Kunan
Wat Phra Kaew
Hakuho
Tochinoshin
Frida Kahlo
Garcia Marquez
Carrack
Lizard
Jack Tar
Landsman
Marlinspike
Sultana
Maidstone
Gibraltar
Donegal
Preble
Chesapeake
Tripoli
Mastico
Syracuse
Argus
Syren
Malaga
Leopard
Aeolus
Africa
Belvidera
Guerriere
Bonne Citoyenne
Java
Bainbridge
Pictou
Marblehead
Cocteau
Guinea
Puna
Turon
Singapore
Savannah
Gambrill
Cuyler
Dewey
Bodger
Anzio
Ardent
Choson
Coronado
Berwick
Firebolt
Kersarge
Laboon
Manzanita
Momsen
Somerset
Tortuga
Colossus
Benavidez
Brittin
Charlton
Eagleview
Guadalupe
Alvaro de Bazan
La Loba
Swiftsure
Laramie
Pecos
Taos
Souverain
Almaak
Chakra
Kalvari
Shisumar
Kolkata
Rajput
Vympel
Shivalik
Talwar
Godavari
Shardul
Magar
Kamorta
Kora
Khukri
Abhay
Saryu
Sukanya
Tinkat
Shalki
Chennai
Mysore
Ranvir
Tabar
Tarkash
Galerna
Mistral
Castilla
Lezo
Serviola
Canabrava
Toralla
Aresa
Alboran
Centinela
Patino
Elcano
Toulon
Richelieu
Dunquerque
Mers-el-Kebir
Rubis
Forbin
Cassard
Aquitaine
Auvergne
Blaison
Belleisle
Tonnant
Bellerophon
Mont Blanc
Pluton
Hortense
Shohei Maru
Asahi Maru
Choyo
Kaiten
Mikaho
Moshun
Ryoju
Kongo
Tsukushi
Katsuragi
Akagi
Kotetsu
Fuso
Yashima
Mishima
Okinoshima
Satsuma
Katori
Kirishima
Nagato
Matsushima
Yoshino
Kasagi
Takasago
Chikuma
Tenryu
Kuma
Sendai
Soryu
Izumo
Hyuga
Osumi
Kunisaki
Hatakaze
Scheherazade
Gormand
Firstborn
Adir
Zumwalt
Throckmorton
Normandy
Magna Carta
Casablanca
Message in a Bottle
Monkey Business
Dorngas
Soyuz
Gorshkov
Zereguchniy
Arthur Foss
Chidiock Tichborne
Vera Hugh
Challenger
Columbia
Endeavor
Discovery
Babcock
Wilcox
Burke
Fletcher
Garfish
Hornet
Nitro
Patoka
Powhatan
Salamonie
Sassacus
Yorktown
Deep-Sea Baby
Steady Progress
Barnacle
Humpback
In the Reeds
Northwest Passage
Yuri Gagarin
Buzz Aldrin
Neil Armstrong
Horizon
Enterprise
Rabbit
Napoleon
Khagan
Yokozuna
Ozeki
Black Bear
Indefatigable
Dauntless
Nautilus
Dolphin
Humboldt
Eagle
Slipstream
Stargazer
Venture
Union
Sunrise
Laotzu
Mencius
Hawk
Confucius
Megalith
Istanbul
Constantinople
Winchester
Magellan
Constellation
Orion
Oracle
Promised Land
Garden of Eden
George Washington
Odysseus
Poseidon
Sinbad
Falling Snow
Quetzal
Quetzlcoatl
Icebreaker
Gorgon
Winston Churchill
Saint Felix
Orca
Snowy Owl
Bombay
Arethusa
Crown Point
Botany Bay
Medway
Allure
Bazinje
Nomad
Redoubtable
Primarch
Great Egret
Jeanne d'Arc
Geronimo
Sitting Bull
Pocahontas
Crazy Horse
Toreador
Chelmsford
Argo
Golden Fleece
Pequod
Beagle
Santa Maria
Bismark
Golden Hind
Mayflower
Monitor
Merrimack
Potemkin
Yamato
Fujiyama
Pretoria
Xiao Yi
Lou Chuan
Zheng He
Baychimo
Constitution
Excelsior
Renaissance
Yellowstone
Jim Jones
John Henry
Paul Bunyan
Robin Hood
Annie Oakley
Emiliano Zapata
North Star
Wanderer
Tears in Rain
Happy Returns
No Gods, No Masters
Majestic
Santa Fe
Hunk of Junk
Bucket of Bolts
Slag Heap
Flying Junkyard
Hammerhead
Heliopolis
Cornwall
Chichen Itza
Small Potatoes
Simon Bolivar
Spartacus
Harriet Tubman
Stonewall Jackson
Shaka Zulu
Silk Road
Good Egg
Terrible Swift Sword
Loaves and Fishes
Hero of Old
Ties That Bind
A Quiet Truth
Fantastic Planet
Observer
Times of Woe
Henry Ford
Charles de Gaulle
Circe
Amelia Earhart
Charles Lindbergh
Roald Dahl
Larry the Ship
Jim Bowie
Pax Republica
Riga
Yerevan
Brasilia
Cape Town
Borealis
Narcissus
Tea Clipper
Close-Hauled
Windjammer
Windstar
Potosi
Minotaur
Ouroboros
Tiamat
Artemis
Annabel Lee
Old Ironsides
Spice of Life
Purifying Gaze
Chateau Gaillard
Sacramento
Labnathia
Brick by Brick
Murano
Johannesburg
Stapleton
Righteous
Venerable
Mjolnir
Starscreamer
Barrabas
Musashi
Misaka
Belo Horizonte
Visby
Pyotr Velikiy
Invincible
Renowned
Courageous
Indomitable
Endurance
Avenger
Unrivaled
Retribution
Allegiance
One Hand Clapping
Washed Away
Cash is King
Equality
Equanimity
Eudamonia
Independence
Interdependence
Mutuality
Proteus
William Rockefeller
Lewis and Clark
Leif Erikson
Marco Polo
Zheng He
Vasco de Gama
Amerigo Vespucci
Jacques Cartier
James Cook
Horatio Hornblower
Thorstein Veblen
Karl Marx
John Maynard Keynes
Milton Friedman
Missouri
Montana
Essex
Karaboudjan
Immer Essen
Scotia
Sherwood
Thunderfish
Venture
Arabella
Baalbek
Barracuda
Bellipotent
Calypso
Forrestal
Compass Rose
Covenant
Dazzler
Fenton
Keeling
Marie Celeste
Hodgson
Okinawa
Orcus
Pharaoh
Pyramus
Reluctant
Saltash
Sturgeon
Swordfish
Seaview
Starview
Umbriago
Valparaiso
Kandahar
Colonia
Shenandoah
Destiny
Rockingham
Atropos
Hotspur
Speedwell
Sutherland
Magicienne
Papillion
Vestal
Remembrance
Ark
Sardine
Pinafore
Minnow
Skydiver
Vondel
Elisabeth Dane
Valkyrie
Geofon
Beowulf
Nunki
Mercury
Venus
Mars
Jupiter
Saturn
Uranus
Neptune
Pluto
Aquarius
Pisces
Aries
Taurus
Gemini
Leo
Virgo
Libra
Scorpio
Sagittarius
Capricorn
Karkinos
Krios
Tavros
Didimoi
Leon
Parthenos
Zygos
Skorpios
Toksotis
Aigokeros
Ydrohoos
Ihtheis
Ophiuchus
Saman Kunan
Wat Phra Kaew
Hakuho
Tochinoshin
Frida Kahlo
Garcia Marquez
Carrack
Lizard
Jack Tar
Landsman
Marlinspike
Sultana
Maidstone
Gibraltar
Donegal
Preble
Chesapeake
Tripoli
Mastico
Syracuse
Argus
Syren
Malaga
Leopard
Aeolus
Africa
Belvidera
Guerriere
Bonne Citoyenne
Java
Bainbridge
Pictou
Marblehead
Cocteau
Guinea
Puna
Turon
Singapore
Savannah
Gambrill
Cuyler
Dewey
Bodger
Anzio
Ardent
Choson
Coronado
Berwick
Firebolt
Kersarge
Laboon
Manzanita
Momsen
Somerset
Tortuga
Colossus
Benavidez
Brittin
Charlton
Eagleview
Guadalupe
Alvaro de Bazan
La Loba
Swiftsure
Laramie
Pecos
Taos
Souverain
Almaak
Chakra
Kalvari
Shisumar
Kolkata
Rajput
Vympel
Shivalik
Talwar
Godavari
Shardul
Magar
Kamorta
Kora
Khukri
Abhay
Saryu
Sukanya
Tinkat
Shalki
Chennai
Mysore
Ranvir
Tabar
Tarkash
Galerna
Mistral
Castilla
Lezo
Serviola
Canabrava
Toralla
Aresa
Alboran
Centinela
Patino
Elcano
Toulon
Richelieu
Dunquerque
Mers-el-Kebir
Rubis
Forbin
Cassard
Aquitaine
Auvergne
Blaison
Belleisle
Tonnant
Bellerophon
Mont Blanc
Pluton
Hortense
Shohei Maru
Asahi Maru
Choyo
Kaiten
Mikaho
Moshun
Ryoju
Kongo
Tsukushi
Katsuragi
Akagi
Kotetsu
Fuso
Yashima
Mishima
Okinoshima
Satsuma
Katori
Kirishima
Nagato
Matsushima
Yoshino
Kasagi
Takasago
Chikuma
Tenryu
Kuma
Sendai
Soryu
Izumo
Hyuga
Osumi
Kunisaki
Hatakaze
Scheherazade
Gormand
Firstborn
Adir
Zumwalt
Throckmorton
Normandy
Magna Carta
Casablanca
Message in a Bottle
Monkey Business
Dorngas
Soyuz
Gorshkov
Zereguchniy
Arthur Foss
Chidiock Tichborne
Vera Hugh
Challenger
Columbia
Endeavor
Discovery
Babcock
Wilcox
Burke
Fletcher
Garfish
Hornet
Nitro
Patoka
Powhatan
Salamonie
Sassacus
Yorktown
Deep-Sea Baby
Steady Progress
Barnacle
Humpback
In the Reeds
Northwest Passage
Yuri Gagarin
Buzz Aldrin
Neil Armstrong
Sally Ride

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
Duchess
Empress
Lady
Mistress
Princess
Duchess
Empress
Lady
Mistress
Princess
Queen

View file

@ -1,6 +1,6 @@
Admiral
Captain
Champion
Commodore
Saint
Admiral
Captain
Champion
Commodore
Saint
Sovereign

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,8 @@
Alderman
Baron
Duke
Emperor
King
Lord
Master
Alderman
Baron
Duke
Emperor
King
Lord
Master
Prince

View file

@ -1,201 +1,201 @@
Star
Sun
Sky
Moon
Nova
Corona
Photon
Aurora
Void
Shockwave
Cloud
Nebula
Quasar
Pulsar
Horizon
Zenith
Comet
Flare
Energy
Galaxy
Ring
Blade
Sword
Light
Flash
Dance
Flood
Bounty
Castle
Temple
Spirit
Trail
Flight
Heart
Pennant
Harvest
Nymph
Mermaid
Siren
Anchor
Hammerhead
Lion
Lioness
Eagle
Silhouette
Guardian
God
Tower
Pillar
Hero
Quest
Journey
Matrix
Palace
Pyramid
Goblet
Sunset
Sunrise
Fish
Symbol
Mark
Realm
Tree
Crossing
Shadow
Swan
Forge
Banner
Voyage
Rose
Song
Raven
Point
Mountain
Island
Forest
Carnation
Gaze
Ship
Cave
Phoenix
Soul
Teacup
Muse
Chest
Courser
Katana
God
Goddess
Hoard
Jumper
Rider
Chaser
Dancer
Seeker
Explorer
Lover
Hunter
Beater
Racer
Piercer
Charger
Speeder
Falcon
Paladin
Cavalier
Spear
Surfer
Strider
Genie
Caravan
Dreamer
Folly
Money Pit
Beauty
Mule
Work Horse
Moneymaker
Starship
Hauler
Beater
Fortune
Dream
Pride
Gamble
Downfall
Regret
Savior
Miracle
Last Chance
Last Stand
Adventure
Jewel
Surprise
Cutter
Cruiser
Spice
Canyon
Tiger
Start
Angel
Son
Boy
Daughter
Girl
Arrow
Bolt
Scholar
Home
Namer
Sting
Apprentice
Walrus
Schooner
Pony
Stick
Wallet
Cone
Carnival
Crossing
Chapel
Echo
Name
Bear
Storm
Bucket
Bilge
Wheel
Wizard
Wall
Unicorn
Gem
Oath
Ghost
Engine
Scallop
Kiwi
Gambit
Pearl
Day
Maid
Mare
Citadel
Dart
Giant
Pioneer
Freehold
Sentry
Sentinel
Zephyr
Terminus
Pinecone
Sickle
Ladybug
Enchantress
Pilgrim
Alligator
Legend
Cutter
Dune
Star
Sun
Sky
Moon
Nova
Corona
Photon
Aurora
Void
Shockwave
Cloud
Nebula
Quasar
Pulsar
Horizon
Zenith
Comet
Flare
Energy
Galaxy
Ring
Blade
Sword
Light
Flash
Dance
Flood
Bounty
Castle
Temple
Spirit
Trail
Flight
Heart
Pennant
Harvest
Nymph
Mermaid
Siren
Anchor
Hammerhead
Lion
Lioness
Eagle
Silhouette
Guardian
God
Tower
Pillar
Hero
Quest
Journey
Matrix
Palace
Pyramid
Goblet
Sunset
Sunrise
Fish
Symbol
Mark
Realm
Tree
Crossing
Shadow
Swan
Forge
Banner
Voyage
Rose
Song
Raven
Point
Mountain
Island
Forest
Carnation
Gaze
Ship
Cave
Phoenix
Soul
Teacup
Muse
Chest
Courser
Katana
God
Goddess
Hoard
Jumper
Rider
Chaser
Dancer
Seeker
Explorer
Lover
Hunter
Beater
Racer
Piercer
Charger
Speeder
Falcon
Paladin
Cavalier
Spear
Surfer
Strider
Genie
Caravan
Dreamer
Folly
Money Pit
Beauty
Mule
Work Horse
Moneymaker
Starship
Hauler
Beater
Fortune
Dream
Pride
Gamble
Downfall
Regret
Savior
Miracle
Last Chance
Last Stand
Adventure
Jewel
Surprise
Cutter
Cruiser
Spice
Canyon
Tiger
Start
Angel
Son
Boy
Daughter
Girl
Arrow
Bolt
Scholar
Home
Namer
Sting
Apprentice
Walrus
Schooner
Pony
Stick
Wallet
Cone
Carnival
Crossing
Chapel
Echo
Name
Bear
Storm
Bucket
Bilge
Wheel
Wizard
Wall
Unicorn
Gem
Oath
Ghost
Engine
Scallop
Kiwi
Gambit
Pearl
Day
Maid
Mare
Citadel
Dart
Giant
Pioneer
Freehold
Sentry
Sentinel
Zephyr
Terminus
Pinecone
Sickle
Ladybug
Enchantress
Pilgrim
Alligator
Legend
Cutter
Dune
Obelisk

View file

@ -1,13 +1,13 @@
1
2
3
4
5
6
7
8
9
10
II
III
1
2
3
4
5
6
7
8
9
10
II
III
IIII

View file

@ -1,54 +1,54 @@
Alan Bean
Albert Einstein
Ascension
Atlantis
Aurora
Buran
Calypso
Cargo Dragon
Challenger
Columbia
Deke Slayton
Discovery
Dragon Capsule
Eagle
Edorado Amaldi
Endeavour
Enterprise
Faith
First Step
Freedom
Friendship
Genesis
Georges Lemaître
Gumdrop
H. G. Wells
Inspire
Johannes Kepler
John Glenn
John Young
Jules Verne
Kosmos
Kounotori
Liberty Bell
Lunar Gateway
Mir
Molly Brown
Odyssey
Resilience
Robert H. Lawrence
Roger Chaffee
Salyut
Sigma
Skylab
Starhopper
Tenacity
Unity
Yankee Clipper
Zarya
Zvezda
Akatsuki
Hubble
Sputnik
Starman
Alan Bean
Albert Einstein
Ascension
Atlantis
Aurora
Buran
Calypso
Cargo Dragon
Challenger
Columbia
Deke Slayton
Discovery
Dragon Capsule
Eagle
Edorado Amaldi
Endeavour
Enterprise
Faith
First Step
Freedom
Friendship
Genesis
Georges Lemaître
Gumdrop
H. G. Wells
Inspire
Johannes Kepler
John Glenn
John Young
Jules Verne
Kosmos
Kounotori
Liberty Bell
Lunar Gateway
Mir
Molly Brown
Odyssey
Resilience
Robert H. Lawrence
Roger Chaffee
Salyut
Sigma
Skylab
Starhopper
Tenacity
Unity
Yankee Clipper
Zarya
Zvezda
Akatsuki
Hubble
Sputnik
Starman
Voyager

View file

@ -1,77 +1,77 @@
Syntron
The Commonwealth
4 3200
6 75 2.5 0.5 0
7 30 0.5 0.5 0 Eorus 0
0 10 0.7 0.2 0
Exits 1 2 5 6
0.5 0.5
--
Tartus 3
The Commonwealth
3 2900
2 70 1.5 -1.3 0
31 25 0.5 0.5 0 Talypso 1
Exits 0 4 6
0.52 0.48
--
Nebulous
Worlds' Republic
7 5100
24 110 2.3 0.9 0
9 60 0.5 0.5 0 Morgana 3
Exits 0 5
0.46 0.55
--
Cayrel
Syndicate
8 3300
4 90 -1.3 -1.65 0
25 100 0.5 0.5 0
Exits 4
0.6 0.420
--
Tterrag Prime
Syndicate
16 7400
17 87 2.2 -1.5 0
65 94 0.5 0.5 0
62 10 0.7 0.8 160
6 7 0.3 0.25 -60
Exits 1 3 6
0.55 0.5
--
Ceherus
The Commonwealth
12 6000
5 65 1.7 2.5 0
48 70 0.5 0.5 0 Darya 2
Exits 0 2
0.48 0.6
--
Rich 4rD
The Commonwealth
3 2100
30 125 -2.7 0.5 0
39 70 0.5 0.5 0
Exits 0 4 1
0.525 0.55
--
Cootlo
The Matriarchy
3 3000
2 75 0.05 0.05 0
16 75 0.5 0.5 0
Exits 8
0.2 0.3
--
Jon Mk2
The Matriarchy
3 3000
2 75 0.05 0.05 0
24 60 0.5 0.5 0
50 42 0.05 0.01 0
58 10 0.15 0.05 0
Exits 7
0.25 0.32
Syntron
The Commonwealth
4 3200
6 75 2.5 0.5 0
7 30 0.5 0.5 0 Eorus 0
0 10 0.7 0.2 0
Exits 1 2 5 6
0.5 0.5
--
Tartus 3
The Commonwealth
3 2900
2 70 1.5 -1.3 0
31 25 0.5 0.5 0 Talypso 1
Exits 0 4 6
0.52 0.48
--
Nebulous
Worlds' Republic
7 5100
24 110 2.3 0.9 0
9 60 0.5 0.5 0 Morgana 3
Exits 0 5
0.46 0.55
--
Cayrel
Syndicate
8 3300
4 90 -1.3 -1.65 0
25 100 0.5 0.5 0
Exits 4
0.6 0.420
--
Tterrag Prime
Syndicate
16 7400
17 87 2.2 -1.5 0
65 94 0.5 0.5 0
62 10 0.7 0.8 160
6 7 0.3 0.25 -60
Exits 1 3 6
0.55 0.5
--
Ceherus
The Commonwealth
12 6000
5 65 1.7 2.5 0
48 70 0.5 0.5 0 Darya 2
Exits 0 2
0.48 0.6
--
Rich 4rD
The Commonwealth
3 2100
30 125 -2.7 0.5 0
39 70 0.5 0.5 0
Exits 0 4 1
0.525 0.55
--
Cootlo
The Matriarchy
3 3000
2 75 0.05 0.05 0
16 75 0.5 0.5 0
Exits 8
0.2 0.3
--
Jon Mk2
The Matriarchy
3 3000
2 75 0.05 0.05 0
24 60 0.5 0.5 0
50 42 0.05 0.01 0
58 10 0.15 0.05 0
Exits 7
0.25 0.32
--

View file

@ -1,18 +1,18 @@
Planets Set (1.0)
Created and Distributed by Wisedawn (https://wisedawn.itch.io/)
Creation Date: 10/04/2019
-----------------------------------------------------------------------------
License: (Creative Commons Zero, CC0)
http://creativecommons.org/publicdomain/zero/1.0/
This content is free to use in personal, educational and commercial projects.
Support us by crediting Wisedawn (this is not mandatory).
-----------------------------------------------------------------------------
Follow on Twitter for updates:
Planets Set (1.0)
Created and Distributed by Wisedawn (https://wisedawn.itch.io/)
Creation Date: 10/04/2019
-----------------------------------------------------------------------------
License: (Creative Commons Zero, CC0)
http://creativecommons.org/publicdomain/zero/1.0/
This content is free to use in personal, educational and commercial projects.
Support us by crediting Wisedawn (this is not mandatory).
-----------------------------------------------------------------------------
Follow on Twitter for updates:
https://twitter.com/wisedawndev

View file

@ -1,34 +1,34 @@
/*
* File: collision.h
* Authors: Nick Koirala (original version), ahnonay (SFML2 compatibility)
*
* Collision Detection and handling class
* For SFML2.
Notice from the original version:
(c) 2009 - LittleMonkey Ltd
This software is provided 'as-is', without any express or
implied warranty. In no event will the authors be held
liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but
is not required.
2. Altered source versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any
source distribution.
*
* Created on 30 January 2009, 11:02
/*
* File: collision.h
* Authors: Nick Koirala (original version), ahnonay (SFML2 compatibility)
*
* Collision Detection and handling class
* For SFML2.
Notice from the original version:
(c) 2009 - LittleMonkey Ltd
This software is provided 'as-is', without any express or
implied warranty. In no event will the authors be held
liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but
is not required.
2. Altered source versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any
source distribution.
*
* Created on 30 January 2009, 11:02
*/

View file

@ -1,19 +1,19 @@
#include <iostream> // for standard input/output
using namespace std; // using the standard namespace
#include "Game.h"
#include "Menu.h"
int main() {
// display "Hello, World!" -- this still appears in our Run terminal as before
cout << "Hello, World!" << endl;
int result = EXIT_SUCCESS;
while (result == EXIT_SUCCESS) {
Menu m;
result = m.result;
if (result == EXIT_SUCCESS) Game g(m.soundOn, m.musicOn);
}
return EXIT_SUCCESS; // report our program exited successfully
#include <iostream> // for standard input/output
using namespace std; // using the standard namespace
#include "Game.h"
#include "Menu.h"
int main() {
// display "Hello, World!" -- this still appears in our Run terminal as before
cout << "Hello, World!" << endl;
int result = EXIT_SUCCESS;
while (result == EXIT_SUCCESS) {
Menu m;
result = m.result;
if (result == EXIT_SUCCESS) Game g(m.soundOn, m.musicOn);
}
return EXIT_SUCCESS; // report our program exited successfully
}

View file

@ -1,22 +1,25 @@
Resources:
----------
Planets: https://wisedawn.itch.io/20-cc0-planets
https://v-ktor.itch.io/planet-sprites
https://v-ktor.itch.io/star-sprites
Font: https://rphstudio.itch.io/space-font
Ships: http://millionthvector.blogspot.com/p/free-sprites.html
http://millionthvector.blogspot.com/p/free-sprites_12.html
Gui: https://craftpix.net/freebies/free-space-shooter-game-gui/
Images: https://commons.wikimedia.org/wiki/File:Dunajec_Gorge_-_Limestone_Rocks_2.jpg
https://unsplash.com/photos/8AwXs7GKzCk
Sounds: https://freesound.org/people/PhreaKsAccount/sounds/46492/
https://freesound.org/people/NenadSimic/sounds/268108/
https://freesound.org/people/plasterbrain/sounds/423166/
Ship Name Components: https://github.com/endless-sky/endless-sky/blob/master/data/human/names.txt
Resources:
----------
Planets: https://wisedawn.itch.io/20-cc0-planets
https://v-ktor.itch.io/planet-sprites
https://v-ktor.itch.io/star-sprites
Font: https://rphstudio.itch.io/space-font
Ships: http://millionthvector.blogspot.com/p/free-sprites.html
http://millionthvector.blogspot.com/p/free-sprites_12.html
Gui: https://craftpix.net/freebies/free-space-shooter-game-gui/
Images: https://commons.wikimedia.org/wiki/File:Dunajec_Gorge_-_Limestone_Rocks_2.jpg
https://unsplash.com/photos/8AwXs7GKzCk
Sounds: https://freesound.org/people/PhreaKsAccount/sounds/46492/
https://freesound.org/people/NenadSimic/sounds/268108/
https://freesound.org/people/plasterbrain/sounds/423166/
https://freesound.org/people/chipfork71/sounds/72239/
Ship Name Components: https://github.com/endless-sky/endless-sky/blob/master/data/human/names.txt
Explosions: https://www.deviantart.com/joesalotofthings/art/Explosion-w-Smoke-Earth-Magic-Special-Effect-869413004