1
Graphics / I have absolutely no idea why this isn't working
« on: September 06, 2011, 06:08:18 pm »
Thanks everyone, I got it to work...but I'm sure I'll be posting in this forum a lot over the course of this project ^_^
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
#include <SFML/Graphics.hpp>
int main(){
sf::RenderWindow App(sf::VideoMode(1024, 768), "Game");
App.UseVerticalSync(true);
//Loads the game font and images
sf::Font GameFont;
if (!GameFont.LoadFromFile("calist.ttf")) {
return EXIT_FAILURE;
}
sf::Image TextBoxImage;
sf::Sprite TextBox;
if (!TextBoxImage.LoadFromFile("Blue.png")) {
return EXIT_FAILURE;
}
TextBox.SetImage(TextBoxImage);
TextBox.SetColor(sf::Color(0, 0, 255, 155));
TextBox.SetPosition(0, 490.f);
TextBox.Scale(1.6f, 1.6f);
const sf::Input& Input = App.GetInput();
bool DrawText = false;
bool Next = Input.IsKeyDown(sf::Key::Return);
//Loads the game Text
sf::String dia1a ("That piece of trash over there is Joey.", GameFont);
//Game Loop
while (App.IsOpened())
{
App.Clear();
App.Draw(TextBox);
App.Display();
//Dialogue for level 1
sf::Event Dialogue1;
while (App.GetEvent(Dialogue1)) {
if (Next = true){
DrawText = true;
}
if ((DrawText = true)) {
App.Draw(dia1a);
App.Display();
}
}
//Close Game
sf::Event GameClose;
while (App.GetEvent(GameClose)) {
if (GameClose.Type == sf::Event::Closed)
App.Close();
}
}
return EXIT_SUCCESS;
}
#include <SFML/Graphics.hpp>
int main(){
sf::RenderWindow App(sf::VideoMode(1024, 768), "Game");
//Loads the game font and images
sf::Font GameFont;
if (!GameFont.LoadFromFile("calist.ttf")) {
return EXIT_FAILURE;
}
sf::Image TextBoxImage;
sf::Sprite TextBox;
if (!TextBoxImage.LoadFromFile("Blue.png")) {
return EXIT_FAILURE;
}
TextBox.SetImage(TextBoxImage);
TextBox.SetColor(sf::Color(0, 0, 255, 155));
TextBox.SetPosition(0, 490.f);
TextBox.Scale(1.6f, 1.6f);
//Loads the game Text
sf::String dia1a ("That piece of trash over there is Joey.", GameFont);
//Game Loop
while (App.IsOpened())
{
App.Clear();
App.Draw(TextBox);
bool DrawText;
//Dialogue for level 1
if (DrawText) {
App.Draw(dia1a);
App.Display();
}
sf::Event Dialogue1;
while (App.GetEvent(Dialogue1)) {
if ((Dialogue1.Type == sf::Event::KeyPressed) && (Dialogue1.Key.Code == sf::Key::Escape)) {
DrawText = true;
}
}
//Close Game
sf::Event GameClose;
while (App.GetEvent(GameClose)) {
if (GameClose.Type == sf::Event::Closed)
App.Close();
}
}
return EXIT_SUCCESS;
}
#include <SFML/Graphics.hpp>
int main(){
sf::RenderWindow App(sf::VideoMode(1024, 768), "Game");
//Loads the game font and images
sf::Font GameFont;
if (!GameFont.LoadFromFile("calist.ttf")) {
return EXIT_FAILURE;
}
sf::Image TextBoxImage;
sf::Sprite TextBox;
if (!TextBoxImage.LoadFromFile("Blue.png")) {
return EXIT_FAILURE;
}
TextBox.SetImage(TextBoxImage);
TextBox.SetColor(sf::Color(0, 0, 255, 155));
TextBox.SetPosition(0, 490.f);
TextBox.Scale(1.6f, 1.6f);
//Loads the game Text
sf::String dia1a ("That piece of trash over there is Joey.", GameFont);
//Game Loop
while (App.IsOpened())
{
App.Clear();
App.Draw(TextBox);
App.Display();
//Dialogue for level 1
sf::Event Dialogue1;
while (App.GetEvent(Dialogue1)) {
if ((Dialogue1.Type == sf::Event::KeyPressed) && (Dialogue1.Key.Code == sf::Key::Escape)) {
App.Draw(dia1a);
}
}
//Close Game
sf::Event GameClose;
while (App.GetEvent(GameClose)) {
if (GameClose.Type == sf::Event::Closed)
App.Close();
}
}
return EXIT_SUCCESS;
}