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

Author Topic: Can't compile sample code  (Read 18063 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Can't compile sample code
« Reply #15 on: September 20, 2010, 05:56:24 pm »
Quote
In Debug mode I need to include libs with -d sufix right?

Yes.

Quote
And which libraries do I need to include when I want build it in Release?

The ones without the -d suffix ;)

Quote
And when I want to share that program with my friend I just need to give him right dll's right?

Yes.

Quote
And it's lagging my computer like hell, app is tkaing 100% CPU all the time, how Can I prevent that?

You have two simple ways of limiting the framerate:
- sfRenderWindow_UseVerticalSync(window, true)
- sfRenderWindow_SetFramerateLimit(window, 60)
Laurent Gomila - SFML developer

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Can't compile sample code
« Reply #16 on: September 20, 2010, 06:01:04 pm »
I think it's not related to FPS, because Your solution did not help.
It laggs the whole computer not only the app.

Extra question:
How to get rid of that console background?
I found that I need to change in Linker's options In System to: Window I did but I can't find CSFML-main.lib so I can't link it and I get:
 error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup



Thanks again man for help You are great big props.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Can't compile sample code
« Reply #17 on: September 20, 2010, 06:04:25 pm »
Quote
I can't find CSFML-main.lib

Indeed it's missing from the CSFML 1.6 SDK. You'll have to handle it by yourself.
Laurent Gomila - SFML developer

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Can't compile sample code
« Reply #18 on: September 20, 2010, 07:49:15 pm »
Yeah, I solved that problem.
I just can't come up with anything that could fix that 100% CPU use.

Code:
http://wklej.org/id/391461/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Can't compile sample code
« Reply #19 on: September 20, 2010, 10:09:07 pm »
Quote
- sfRenderWindow_UseVerticalSync(window, true)
- sfRenderWindow_SetFramerateLimit(window, 60)

These two functions do reduce the CPU usage of your application. How did you try to use them?
Laurent Gomila - SFML developer

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Can't compile sample code
« Reply #20 on: September 20, 2010, 10:18:28 pm »
I tried using after:
aaa =  sfRenderWindow_Create(Mode, "Maslo", sfResize | sfClose, Settings);
sfRenderWindow_SetFramerateLimit(aaa, 60);
sfRenderWindow_Display(aaa);
I also tried to use that in loop but no effect.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Can't compile sample code
« Reply #21 on: September 20, 2010, 11:47:59 pm »
What if you call sfSleep in your main loop?
Laurent Gomila - SFML developer

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Can't compile sample code
« Reply #22 on: September 21, 2010, 07:31:27 am »
It was lagging like hell because I placed:
 sfRenderWindow_Clear(aaa, sfBlack);

In infinite loop so it was refresing it all the time, I placed it outside and it's all good.


Thanks again You can close now.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Can't compile sample code
« Reply #23 on: September 21, 2010, 07:54:05 am »
You're supposed to clear your window all the time. You'll probably come back to the same problem when you start drawing something.
Laurent Gomila - SFML developer

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Can't compile sample code
« Reply #24 on: September 21, 2010, 08:00:48 am »
God damn it, really?
SfSleep is not helping.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Can't compile sample code
« Reply #25 on: September 21, 2010, 08:07:17 am »
What's your graphics card? Are your drivers up-to-date?
Laurent Gomila - SFML developer

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Can't compile sample code
« Reply #26 on: September 21, 2010, 08:10:37 am »
Nvidia GeForce 7600GS 256MB DDR2.
Drivers are not the newest but they are also not the oldest.
Version of them: 6.14.11.9621

Hmm I can't come up with anything that could prevent it, damn.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Can't compile sample code
« Reply #27 on: September 21, 2010, 08:37:47 am »
Are you able to run games or OpenGL apps on this computer?
Laurent Gomila - SFML developer

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Can't compile sample code
« Reply #28 on: September 21, 2010, 02:35:40 pm »
EDIT: Solved, I wasn't updating the window when I putted in a loop:

sfRenderWindow_Clear(aaa, sfRed);
sfRenderWindow_Display(aaa);

It is working great now, thank again mate.