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.


Messages - Rexona for men

Pages: [1] 2
1
General / Re: linker error: cannot open sfml-...
« on: June 20, 2012, 09:28:21 am »
Quote
I also tried the precompiled dlls for my IDE, but no success.

 ;)
Of course I linked directly into the folders of the precompiled package.

Quote
And what's "blub"??
I just wrote "blub" instead of sfml-audio-2.lib (or sfml-audio-d-2.lib), sfml-system-2.lib and so on.

E: Linking the static libaries works perfectly fine  :o
E2: Of course I had to add the SFML_STATIC macro, which was missing when I tried the dlls.

2
General / linker error: cannot open sfml-...
« on: June 19, 2012, 10:48:36 pm »
I checked my Settings more then ten times, but still get linker error 1104: cannot open blub

I downloaded and compiled the SFML 2.0 version from the download site.
I put all needed dlls, both debug and release, in a separated folder and added this one to the libary directories. (I do not added the macro SFML_DYNAMIC nor the macro SFML_STATIC)
The filenames are perfectly right (copied and pasted them, but still got the error).

IDE is Visual Studios Express 2010.

I also tried the precompiled dlls for my IDE, but no success. Creating a completly new project did not help, too.

I'm running out of ideas, anyone has a clue?



3
General / From Event to Key
« on: October 26, 2011, 08:46:19 pm »
Thank you for your help, but my new Method work fine  :D

4
General / From Event to Key
« on: October 26, 2011, 05:51:14 pm »
I thought about such a solution like this but first , I dont want such a huge if-statement, because a switch statement would be much clearer in this case in my opinion.
And second, I dont want to separate keyinput from event.

To make it maybe a bit clearer, I want that a pressed key counts as an event like Window.Close ()

At the moment, I try this (but have to wait a bit for the spaceship sprite)

Code: [Select]

switch (event.Type)
some events
.
.
case KeyPressed
    InputManager (event.Key.Code) // go on with the pressed key


Will this code work?


Hm, I thnik I will post the whole code  :D

GameProcedure
Code: [Select]

void Game::GameProcedure ()
{
    while (Window.IsOpened () )
    {
        sf::Event Event;
        while (Window.GetEvent (Event) )
        {
switch (Event.Type)
{
case sf::Event::Closed:
{
Window.Close ();
}
break;
case sf::Event::KeyPressed:
{
InputManager (Event.Key.Code);
}
break;
}
        }
        Window.Clear ();

Window.Draw (S_Background);

        Window.Display ();
    }
}



And here is InputManager
Code: [Select]

void Game::InputManager (sf::Key::Code Input)
{
float ElapsedTime = Window.GetFrameTime ();

switch (Input)
{
case sf::Key::Left:
{
MyPlayer.Move (-400 * ElapsedTime, 0);
}
case sf::Key::Right:
{
MyPlayer.Move (400 * ElapsedTime, 0);
}
}
}

5
General / From Event to Key
« on: October 26, 2011, 05:13:51 pm »
Hello guys

I played a bit around with the SFML and encounter a problem, for which I havent a solution.

I work on a little game with a spaceship, which fly around.
I have a main game loop with event,move objects, clear screen, draw objects and display.
However, I stuck on the event to move part

my function is like this
Code: [Select]

switch (Event.Type)
some events
.
.
case Window.KeyPressed:
    InputManager (Window.GetInput () )


And InputManager looks like this
Code: [Select]

void InputManager (sf::Key::Code Input)
switch (Input)
    case sf::Key::Code::Left
        Move (left)
.
.
some other key case



Ive thought about seperate the functions, but I dont like the idea.
For me, an input is an event.
Of course there is the function IsKeyPressed, but it only returns true or false and not the pressed key.
Also sf::Input cant be put into a switch statement, as like IsKeyPressed.
I dont have a solution, maybe anyone have a better Idea?

6
Graphics / access Violation Image::LoadFromFile()
« on: October 25, 2011, 03:41:02 pm »
Yeah thx =D

Now all is working fine

7
Graphics / access Violation Image::LoadFromFile()
« on: October 25, 2011, 03:00:41 pm »
Problems seems to be solved and thx for the list, I didnt think about it =P

However, now I have a new Problem.

After first creating, even before clearing, the window is closed immediatly.
(Probably just a stupid mistake by me =S)

Here the reworked sourece code of the memberfunctions of Game

Code: [Select]

#include "Game.hpp"

Game::Game ()
{
// do nothing atm
}

Game::~Game ()
{
// do nothing atm
}


void Game::InitGame ()
{
sf::RenderWindow (sf::VideoMode (800, 600, 32), "Game");

InitBackground ();
}


void Game::RenderProcedure ()
{
    while (Window.IsOpened () )
    {
        sf::Event Event;
        while (Window.GetEvent (Event) )
        {
            if (Event.Type == sf::Event::Closed)
                Window.Close ();
        }
        Window.Clear ();

Window.Draw (S_Background);

        Window.Display ();
    }
}


void Game::InitBackground ()
{
I_Background.LoadFromFile ("background.tga");

S_Background.SetImage (I_Background);
S_Background.Resize (800, 600);
S_Background.SetPosition (0.0, 0.0);
S_Background.SetCenter (0.0, 0.0);
}

8
Graphics / access Violation Image::LoadFromFile()
« on: October 25, 2011, 02:12:59 pm »
By the way, Libaries should be correctly linked.
The folder Graphic is in the same folder as the code datas.

9
Graphics / access Violation Image::LoadFromFile()
« on: October 25, 2011, 02:03:39 pm »
Hello guys

I got an access Violation while loading an Image.
Here is the Error code:

Code: [Select]
Unbehandelte Ausnahme bei 0x10189024 (sfml-graphics-d.dll) in SFML Game.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0xcccccd00.

( In English: Unhandled Exception in Game.exe, Access Violation reading at position)


And here some of the source code (which isnt well designed atm =P)

Quote

void Game::InitBackground ()
{
   I_Background->LoadFromFile ("Graphic/background.tga");// here it chrashes
   
        // just some tests with random numbers
   S_Background->SetImage (*I_Background);
   S_Background->Resize (800, 600);
   S_Background->SetPosition (0.0, 0.0);
   S_Background->SetCenter (0.0, 0.0);
}


This should be the critical part as the debugger "told" me.

Additional the declaraton of class Game:

Code: [Select]

class Game
{
public:
Game (unsigned width, unsigned height, unsigned pixelformat);
~Game ();
void InitGame ();
void RenderProcedure ();


private:
void InitBackground ();

sf::RenderWindow* Window;
sf::Image* I_Background;
sf::Sprite* S_Background;
};



And Another question:
Which picture formats do SFMl support?
Cant find somethin about this in the documentation.

10
Graphics / SubRect dont work
« on: August 28, 2011, 03:31:31 am »
Thanks for help, I defined a new memberfunction for setting the subrect :D

11
Graphics / SubRect dont work
« on: August 28, 2011, 01:45:10 am »
Huh, dont think you need the code, im very sorry.

Code: [Select]
#include <SFML/Graphics.hpp>
#include <string>


class Racetrack
{
public:
Racetrack ();
sf::Sprite GetSprite ();
static void Init (const std::string& filename);

private:
sf::Sprite Tracksprite;
static sf::Image TrackImage;
};




Code: [Select]
#include "Racetrack.hpp"

Racetrack::Racetrack ()
{
Tracksprite.SetImage (TrackImage);
Tracksprite.SetPosition (100.0f, 100.0f);

}


sf::Sprite Racetrack::GetSprite ()
{
return Tracksprite;
}

sf::Image Racetrack::TrackImage;

void Racetrack::Init (const std::string& filename)
{
TrackImage.LoadFromFile (filename);
}

12
Graphics / SubRect dont work
« on: August 28, 2011, 01:18:40 am »
Im really confused what is wrong in my code :shock:
All is fine but the sprite is full displayed and not only it's subrect.

Code: [Select]
#include "Racetrack.hpp"



int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

Racetrack::Init ("data/Track2.png");

Racetrack track1;
track1.GetSprite ().SetSubRect (sf::IntRect (100, 100, 200, 200) );
   
    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }
       
        // Clear the screen (fill it with black color)
App.Clear(sf::Color (sf::Uint8 (40), sf::Uint8 (200), sf::Uint8 (30) ) );

App.Draw (track1.GetSprite () );

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}

13
Graphics / Problem with the RenderWindow Tutorial
« on: August 15, 2011, 09:57:11 pm »
Okay, thank you very much for helping me over nearly a week  :D .

Then Ill look a around a bit in the forum.

14
Graphics / Problem with the RenderWindow Tutorial
« on: August 14, 2011, 08:37:26 pm »
Quote
Make sure that in debug mode, you link to the debug libraries ("-d" suffix), not the release ones.


I tried both. No effect.

Quote
Do you use VC++ 2010 or 2008? If 2010, have you recompiled SFML first?


I have 2010, have I recompiling all the lib datas before using them?
In this case, is there a good tutorial for this?
I give a look at the last paragraph in the mainpage Tutotial for VS,
but I didnt got any lib datas.

 :o

It says, that the output directory isn't the same as given in Linker.
And I got many warnings, i'll translate them, if needed, but at the moment I'm to tired    :oops:
(had a long weekend seminar)
Btw, samples and SFML project cant be loaded.
Is this a problem for me?

15
Graphics / Problem with the RenderWindow Tutorial
« on: August 12, 2011, 10:35:44 pm »
It seems to happen, when the App.Clear function is called.
By the way I just copied the code from the Tutorial section.

In the log I get:
First execption at 0x0100a800 in test,exe 0xC0000005: Access violation

It also says, that the heap is damaged.

Here my code if it's needed:

Code: [Select]
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>

int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
   
    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
App.Close();
        }

        // Clear the screen (fill it with black color)
App.Clear();

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}

Pages: [1] 2