Here are all the parts pertaining to SFML, as far as I can tell at least,
#include <iostream>
#include <fstream>
#include <string>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
using namespace std;
/// Entry point of application
///
/// \return Application exit code
///
//------------------------------SF stuff------------------------------------------
sf::RenderWindow Window(sf::VideoMode(650, 400, 32), "Avian");
sf::Clock Clock;
sf::Image ZepImage;
sf::Image BG1Image;
sf::Image BG2Image;
sf::Image BG3Image;
sf::Image BG4Image;
//--------------------------End SF stuff------------------------------------------
class CannonBall{
public:
float mass;
float X;
float Y;
float VelX;
float VelY;
};
class Zepplin{
public:
float X;
float Y;
float BattleX;
float BattleY;
float Speed;
float Health;
sf::Sprite ZepSprite;
CannonBall Balls[10];
}PlayerZepplin;
int WKeyDown(){
if(Window.GetInput().IsKeyDown(sf::Key::W)){
return 1;
}
}
int SKeyDown(){
if(Window.GetInput().IsKeyDown(sf::Key::S)){
return 1;
}
}
int AKeyDown(){
if(Window.GetInput().IsKeyDown(sf::Key::A)){
return 1;
}
}
int DKeyDown(){
if(Window.GetInput().IsKeyDown(sf::Key::D)){
return 1;
}
}
float GetTime(){
return Clock.GetElapsedTime();
}
float Time;
class Background{
public:
sf::Sprite BGSprite;
float X;
float Y;
}BG1, BG2, BG3, BG4;
void ScrollBG(Background BG){
if (!(BG.X < -210)){ //if the BG isn't very far left
BG.X = BG.X - 2;
}
else{
BG.X = 1390;//three 400 -210, allows four different backgrounds
}
}
void ZepBattle(){
int BattleOn = 4;
while (BattleOn){
while (Window.IsOpened()){
Time = GetTime();
Window.Clear();
//---------------------------------------------------------------
if (WKeyDown()){
PlayerZepplin.BattleY = PlayerZepplin.BattleY + ((20 * (Time/GetTime())) * PlayerZepplin.Speed);
}
if (SKeyDown()){
PlayerZepplin.BattleX = PlayerZepplin.BattleX - ((20 * (Time/GetTime())) * PlayerZepplin.Speed);
}
if (AKeyDown()){
PlayerZepplin.BattleX = PlayerZepplin.BattleX - ((20 * (Time/GetTime())) * PlayerZepplin.Speed);
}
if (DKeyDown()){
PlayerZepplin.BattleX = PlayerZepplin.BattleX + ((20 * (Time/GetTime())) * PlayerZepplin.Speed);
}
//---------------------------------------------------------------
ScrollBG(BG1);
ScrollBG(BG2);
ScrollBG(BG3);
Window.Draw(BG1.BGSprite);
Window.Draw(BG2.BGSprite);
Window.Draw(BG3.BGSprite);
Window.Draw(BG4.BGSprite);
Window.Draw(PlayerZepplin.ZepSprite);
Window.Display();
}
}
}
void Initalize(){
if(!ZepImage.LoadFromFile("Zep.png"))
PlayerZepplin.ZepSprite.SetImage(ZepImage);
PlayerZepplin.ZepSprite.SetCenter(9.5f,9.5f);
PlayerZepplin.ZepSprite.SetPosition(200,200);
PlayerZepplin.Speed = .95f;
if(!BG1Image.LoadFromFile("BG1.png"))
if(!BG2Image.LoadFromFile("BG2.png"))
if(!BG3Image.LoadFromFile("BG3.png"))
if(!BG4Image.LoadFromFile("BG4.png"))
BG1.BGSprite.SetImage(BG1Image);
BG2.BGSprite.SetImage(BG2Image);
BG3.BGSprite.SetImage(BG3Image);
BG4.BGSprite.SetImage(BG4Image);
}
void Menu(){
}
int main(){
Initalize();
Menu();
ZepBattle();
}
I apologize for putting it all in there, I just don't know another way to do it.
Also, no I haven't looked at the Code::Blocks page, it really didn't occur to me. THough I don't know what I would be looking for.