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 - Jesper Juhl

Pages: 1 ... 92 93 [94]
1396
Graphics / Re: [Beginner] Help with Bouncing Circles
« on: February 01, 2014, 05:19:18 am »
Read this: http://www.gamasutra.com/view/feature/131424/pool_hall_lessons_fast_accurate_.php?print=1
It describes very nicely how to do circle/circle collision detection.

1397
General / Re: What is sf::NonCopyable::NonCopyable'?
« on: January 30, 2014, 09:32:41 pm »
Although other people have already given good answers on what to do to fix your code it seems to me that no one actually answered the original question "What is sf::NonCopyable::NonCopyable". So let me just briefly do that.

sf::NonCopyable is a class that, if you inherit from it, will make it impossible to create a copy of an instance of your derived class. It does this by making the copy-constructor and copy-assignment operator private.
This is useful when copying an instance of a class would lead to incorrect or undesirable behaviour.

The documentation for the class is available here: http://www.sfml-dev.org/documentation/2.1/classsf_1_1NonCopyable.php.

1398
Graphics / Re: text object prints out name of font when drawn
« on: January 30, 2014, 09:19:42 pm »
With C++11 this does what you seem to want:

  text.setString(std::to_string(count));

With C++98/03 you can use a stringstream to obtain a textual representation of your count integer (this also works with C++11 of course).

There is also the option of using something like boost::lexical_cast or even functions from the C library (like sprintf) although I would not recommend that.

1399
I think reading the "Fix your time step" http://gafferongames.com/game-physics/fix-your-timestep/ article (and the other articles in that series) would do you good regarding understanding that time/clock code :)

1400
Graphics / Re: Best method for using a texture pool?
« on: January 30, 2014, 08:18:13 pm »
I assume this is with an optimized release build and not an unoptimized debug build? If not, then building with optimization enabled is the obvious step one.

Step two (for me at least) would be to run the programme through a profiler and take a look at what it pinpoints as the top 5 resource eaters.

You should also check that your video card drivers are up to date since sometimes there are big leaps in performance between driver versions.

Just a few places to start  :)

1401
General discussions / Re: A quick trick for Linux SFML apps
« on: January 26, 2014, 10:14:51 pm »
If the library location is fixed then an even better option would be to use the linkers -rpath option to put that directory directly into the executable as a path the runtime linker should search for libraries.
Simply do this when linking:

g++ -o my_executable somefile.o someotherfile.o -L/dir/to/search/for/libs/to/link -lsfml-window -lsfml-system -lsomeotherlib -Wl,-rpath=/path/the/runtime/linker/should/search ...other-options-you-may-be-using...

You can then check the resulting executable to make sure that the rpath got set correctly with

readelf -d my_executable | grep RUNPATH

and you should see a line like this:

0x000000000000001d (RUNPATH)            Library runpath: [/path/the/runtime/linker/should/search]

and then you don't need a wrapper script any more.


1403
SFML projects / Re: Chesster [SFML Puzzle Game]
« on: January 18, 2014, 07:55:23 pm »
From the video this looks like fun.
Unfortunately, without a Linux build I'm not going to be able to play it  :(
Any plans for a Linux version in the future?

1404
Graphics / Re: Overriding draw() in sf::Drawable.
« on: January 11, 2014, 10:57:22 pm »
I'm an idiot. I misread his question.

1405
Graphics / Re: Overriding draw() in sf::Drawable.
« on: January 11, 2014, 10:51:25 pm »
sf::Drawable::draw() is pure:
  virtual void draw(RenderTarget& target, RenderStates states) const = 0;
You must implement it when you inherit from sf::Drawable.

Simply do:

class Entity : public sf::Drawable
{
public:
  ... your public stuff.
private:
  void draw(sf::RenderTarget& target, sf::RenderStates states) const;
};

and then write an implementation for Entity::draw()... it will need to do something along the lines of this:

void Entity::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
  ...
  target.draw(<some_sprite_or_whatnot>, states);
  ...
}

Pages: 1 ... 92 93 [94]
anything