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 - robvleugel

Pages: [1] 2
1
General / Re: FindSFML cannot find SFML
« on: December 07, 2013, 10:16:22 pm »
This is the code I use in my CMakeLists file:

Code: [Select]
# Detect and add SFML
find_package(SFML 2 REQUIRED system window graphics network audio)
if(SFML_FOUND)
  include_directories(${SFML_INCLUDE_DIR})
  target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})
endif()

And the FindSFML.cmake is this one:
https://github.com/SFML/SFML/blob/master/cmake/Modules/FindSFML.cmake (unmodified)


I added set(SFML_ROOT "C:\\Project Files (x86)\\SFML") just before the find_package call and this did not help either.



Edit:

Apparently its not Project Files (x86) but Program Files (x86)  ::)
It works now, thanks for your time and sorry for bothering you with this

2
General / Re: FindSFML cannot find SFML
« on: December 07, 2013, 03:30:50 pm »
Quote
I've set a system variable SFML_ROOT to "C:\Project Files (x86)\SFML"
You mean an environment variable? It should work, but you can try to define it as a CMake variable instead.

Quote
E.g. System.hpp is located in "C:\Program Files (x86)\SFML\include\SFML
And "C:\Program Files (x86)\SFML\lib" contains all the SFML libraries, right?

Yes obviously, its just the whole content of the zip file so the SFML\lib contains all the .lib files that came with the package.
I checked out echo %SFML_ROOT% in the command and the environment var was set correct. Ill try the cmake var when I get home but I do not understand why its not working now, setting SFML_ROOT in cmake should not make any difference in theory.

3
General / FindSFML cannot find SFML
« on: December 07, 2013, 02:31:58 pm »
Hello all,

I always used SFML with Visual studio without problems, but now recently I want to change from a VS environment to Cmake so I can develop both on my windows PC and my linux laptop.

The problem arises when using the find_package(SFML 2 REQUIRED system window graphics network audio)
I've added the FindSFML.cmake file, but I get the following error when trying to run cmake:

"Cmake Error at cmake_modules/FindSFML.cmake:307 (message):
   Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY etc. etc.

I installed SFML in C:\Project Files (x86)\, I've set a system variable SFML_ROOT to "C:\Project Files (x86)\SFML". I'm clueless to why it cannot find this directory. This directory contains the complete content of the SFML-2.1-windows-vc11-64bits.zip file that I just downloaded, did I have to do more to install SFML?
(E.g. System.hpp is located in "C:\Program Files (x86)\SFML\include\SFML")

Kind regards,
Rob

4
Audio / Re: Not playing sound from function
« on: May 20, 2012, 04:38:33 pm »
It was indeed an error in the code not being shown here, a realy stupid one so I'm glad I didn't post it :)
Thanks for the help anyway!


Kind regards,
Rob








5
Audio / Re: Not playing sound from function
« on: May 18, 2012, 10:37:55 pm »
Hm I am still getting problems.
For instance, take the class below:

class AudioManager
{
private:
        sf::SoundBuffer m_soundbuffer;
        sf::Sound m_sound;

public:

        void Init();
        void PlaySound() {m_sound.play();}

};

void AudioManager::Init()
{
m_soundbuffer.loadFromFile("mysound.wav");
m_sound.setBuffer(soundbuffer);
}
 

This gives me a crash when I try to use it.
What am I doing wrong this time?


Kind regards,
Rob

6
Audio / Re: Not playing sound from function
« on: May 18, 2012, 09:48:05 pm »
I guess I already figured it out.
Because I create the sf:Sound and sf::SoundBuffer within the function, these are local variables and are removed as soon as the code has been executed. Even while play() will play within a separate thread, this code will reference to a SoundBuffer that is not accessible, am I right?

So for my code to work I just have to make the sf::Sound(Buffer) objects part of the class that uses them.

Sorry for my post, guess I should've been more patient.

Greetings,
Rob


7
Audio / Not playing sound from function
« on: May 18, 2012, 09:33:49 pm »
Hello,

I am having some problems with the sfml audio package. My code to load the sound is the code below:

#include <SFML\System.hpp>
#include <SFML\Audio.hpp>

void Playsound()
{
        sf::Sound sound;
        sf::SoundBuffer sbuffer;
        sbuffer.loadFromFile("boom.wav");
        sound.setBuffer(sbuffer);
        sound.play();
}

int main()
{
        Playsound();
        sf::Clock clock; while(clock.getElapsedTime().asSeconds() < 5) {}
        return 0;
}
 

If I move the code from Playsound() to main it works. It doesn't work from within a function.
I mean this makes it hard to play a sound isn't it, what am I doing wrong?

8
Window / Re: Window unhandled exception error
« on: March 31, 2012, 07:43:26 pm »
Quote
After rebooting my system everything works fine again
You should always do that first, when something that has always worked suddenly breaks without any modification ;)

Yeah, or pull the plug and put it back in.
That's actually how I could've fixed this one as well.
It seems my laptop changes to some other graphics mode when I remove the power cable to save on the battery. It turns out SFML does not work while in this mode, which is strange as most other applications run just fine. I had the power cable back in when this message appeared in the morning, but I guess I forgot to press the "change graphic mode" button on the popup that appears.

I can reproduce the error now simply by changing to this mode.

9
Window / Re: Window unhandled exception error
« on: March 31, 2012, 05:24:20 pm »
After rebooting my system everything works fine again.
Weird..

10
Window / Re: Window breakpoint error
« on: March 31, 2012, 02:37:30 pm »
Ow sorry forgot about that, the error I get is:

Code: [Select]
"Unhandled exception at 0x0af28e0b in MyProgram.exe: 0x0000005: Acces violation reading location 0x0b0f7cf8

[Break] [Continue]

An error like this usually means reading to an unitialized variable.

Running in debug mode, it breaks when calling m_app.display();

I'm using MS Visual studio express edition, on a HP laptop running Windows 7 (intel i5 core with ATI mobility Radeon), 4gig ram.


11
Window / Window unhandled exception error
« on: March 31, 2012, 02:13:56 pm »
Ugh now what, everything seemed to work fine yesterday, but today started to open my game again and I suffered from another breakpoint memory error. I deleted basicly all of my game code and it comes down to the code below:

It breaks at WglContext.cpp
Code: [Select]
void WglContext::display()
{
    if (m_deviceContext && m_context)
        SwapBuffers(m_deviceContext);
}


Output window:

+      m_context   0x00010002 {unused=0 }   HGLRC__ *
+      m_deviceContext   0x590118ed {unused=??? }   HDC__ *
+      this   0x09224fd0 {m_window=0x0010085a m_deviceContext=0x590118ed m_context=0x00010002 ...}   sf::priv::WglContext * const

My code:

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

int main()
{
sf::RenderWindow m_app;
m_app.create(sf::VideoMode(500, 500, 32), "MyProgram");

while(true)
{
m_app.clear(sf::Color(65,5,23));
m_app.display();
}

return 0;
}


Because this code is so basic (and because the example program on the documentation website gives me the same error), it can't be my code right?
I downloaded the newest snapshot of SFML2 and build/installed it but it still gives me the same error.
I'm pretty sure I'm linking with the static debug libraries correctly, as I did not change anything and it used to work fine til today. Removing the "m_app.display();" makes it run.

Linking with:
sfml-system-s-d.lib;sfml-window-s-d.lib;sfml-graphics-s-d.lib;libpq.lib;%(AdditionalDependencies)


What is going on here? I'm completely clueless.


12
General discussions / New naming convention
« on: March 13, 2012, 09:12:54 pm »
Quote from: "Laurent"
Quote
you should definitely decide it now

Hum? It's decided, and it's changed now. So what do you mean?


You didn't wait for his approval?
Btw I like the new convention, but to be honest I started to get used to the old one and I changed my convention to the same one mainly because of SFML. I realy have to get used to it again.

Oh and I noticed the sf::Mouse:: and sf::Mouse::Left didn't change, whats the reason behind this?

13
General discussions / New naming convention
« on: March 12, 2012, 10:12:42 pm »
Downloading the newest snapshot right now...
I hope a "find - replace all" will do
I hope this new version also fixes all those heap corruption bugs I'm getting in my game lately

14
Window / Buttons and Menu, please help.
« on: March 04, 2012, 09:48:35 pm »
There is no integrated GUI in SFML, you can either use a third party GUI like SFGUI, or create the GUI yourself.

Creating the GUI yourself means you'll create a button in paint, add a sf::Sprite to your window with your button image as texture. Than you should write code like:

Code: [Select]

//pseudocode
if(mouse.x >= button.x && mouse.x <= button.x+button.width && mouse.isPressed() && mouse.y >= button.y && mouse.y <= button.y+button.height){OnClick()}


You probably want to put this into a class and add some slightly advanced code with different button textures on mouse hoover and button press, but you should get the point.

15
Window / Unhandled exception on window creation
« on: March 04, 2012, 09:29:17 pm »
Pff so after struggling with breakpoint errors for over 3 weeks, I finaly found out what caused all my problems.

I've been using a game-state system that I found on some tutorial website without spending too much attention to it as it worked fine in the beginning. After changing this gamestate system I have no problems anymore. It seems that the singleton-gamestates I've used somehow caused trouble with the static sfml object members, but not with pointers to them. I don't know why exactly.

So no bug in SFML after all :)

Pages: [1] 2
anything