Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

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.


Topics - Auron

Pages: [1]
1
Graphics / String, Variables & Values
« on: August 08, 2009, 11:04:05 pm »
Hello,

How would I display the value of a variable in a string?

IE.

int Health = 100;

How would I use a string to display "100" in the string have it shown on the window?

2
Graphics / Image Not Showing
« on: August 05, 2009, 07:10:40 pm »
Hey Guys,

I went through the examples and tried displaying an image on the screen, but it won't shop up. My code is right and it compiles without errors, but the window is blank. Here's my code.

Code: [Select]

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include <wchar.h>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Network.hpp>

#include "player.h"
#include "vehicle.h"

int main()
{
    sf::RenderWindow App(sf::VideoMode(800,600,32), "Car Junker - DarkScar Games");
   
    const sf::Input& Input = App.GetInput();
   
    bool Logo_Screen = true;
    bool Title_Screen = false;
   
    sf::Image TitleScr;
    sf::Image LogoScr;
   
    if(!TitleScr.LoadFromFile("Title.png"))
    {
        return EXIT_FAILURE;
    }
    sf::Sprite TitleSprt(TitleScr);
   
    if(!LogoScr.LoadFromFile("Logo.png"))
    {
        return EXIT_FAILURE;
    }
    sf::Sprite LogoSprt(LogoScr);
   
    LogoSprt.SetImage(LogoScr);
   
    bool LeftKeyDown = Input.IsKeyDown(sf::Key::Left);
    bool RightKeyDown = Input.IsKeyDown(sf::Key::Right);
    bool UpKeyDown = Input.IsKeyDown(sf::Key::Up);
    bool DownKeyDown = Input.IsKeyDown(sf::Key::Down);
    bool SpaceDown = Input.IsKeyDown(sf::Key::Space);
    bool LeftMouseDown = Input.IsMouseButtonDown(sf::Mouse::Left);
    bool RightMouseDown = Input.IsMouseButtonDown(sf::Mouse::Right);
    unsigned int MouseX = Input.GetMouseX();
    unsigned int MouseY = Input.GetMouseY();
   
    Player* gPlayer = new Player();
    Vehicle* gVehicle = new Vehicle();
   
    sf::Clock Clock;
   
    while(App.IsOpened())
    {
        sf::Event Event;
       
        App.SetFramerateLimit(60);
       
        while(App.GetEvent(Event))
        {
           
            if(Event.Type == sf::Event::Closed)
            {
                App.Close();
            }
           
            if(Event.Key.Code == sf::Key::Escape)
            {
                App.Close();
            }
           
            if(Event.Key.Code == sf::Key::Left)
            {
                LeftKeyDown = true;
                gPlayer->X = gPlayer->X - 5;
            }
            else if(Event.Key.Code == sf::Key::Right)
            {
                RightKeyDown = true;
                gPlayer->X = gPlayer->X + 5;
            }
            else if(Event.Key.Code == sf::Key::Up)
            {
                UpKeyDown = true;
                gPlayer->Y = gPlayer->Y - 5;
            }
            else if(Event.Key.Code == sf::Key::Down)
            {
                DownKeyDown = true;
                gPlayer->Y = gPlayer->Y + 5;
            }
        }
       
        App.Draw(LogoSprt);
       
        App.Clear(sf::Color(0,0,0,0));
       
        App.Display();
    }
   
    return EXIT_SUCCESS;
}

3
Window / Show FPS In Title Bar Window
« on: August 05, 2009, 04:27:33 am »
Hey Guys,

I was wondering if there was a way to show the FPS or Framerate in the title bar of the window? I've seen it done in other libraries and engines, but I have just started using SFML. Any exmaples, please?

Pages: [1]