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

Pages: [1] 2 3 ... 9
1
Graphics / sprite.move makes sprite disappear
« on: April 09, 2011, 09:48:42 am »
Use time-based movement rather than frame based movement.

I.e. get the amount of time passed since the last frame (there's a function in sf::Window for this) and multiply your values with that. Assuming your values are "move this amount per second".

2
Audio / Sound fails on repeated play
« on: April 07, 2011, 06:15:20 pm »
Most definitely - yes.

Are you doing this per frame though? That seems largely wasteful. You'll want to load everything in during initialization (as much as possible) - reuse them every frame, and then delete during cleanup/finalization.

3
Audio / Sound fails on repeated play
« on: April 07, 2011, 05:46:06 pm »
According to that text, it sure looks like I'm in error.

However, I'm not. The quote you refer to is only true for non-pointer objects.

Simple test:
Code: [Select]
#include <vector>

class Test
{
public:
Test() { };
~Test() { printf("Destructor called\n"); }
};

int main()
{
std::vector<Test> v;
Test test;
v.push_back(test);
v.clear();

return 0;
}


This will return "Destructor called" twice (once from the clear operation, and once for the local variable running out of scope).

However, replace it with:

Code: [Select]
#include <vector>

class Test
{
public:
Test() { };
~Test() { printf("Destructor called"); }
};

int main()
{
std::vector<Test*> v;
Test * test = new Test;
v.push_back(test);

v.clear();

return 0;
}


And it won't print anything at all.

4
Audio / Sound fails on repeated play
« on: April 07, 2011, 05:30:50 pm »
You're never deleting your sounds? Just calling clear won't help, thus the destructor isn't being called - you're probably filling up all the available voices.

5
Graphics / How to load multiple images while key is being pressed
« on: April 06, 2011, 09:10:11 am »
You could do that, and just use the filename.

Or you put them in a subfolder (like say "data") and use "data/myfile.png" to load it.

6
Graphics / How to load multiple images while key is being pressed
« on: April 05, 2011, 03:49:29 pm »
You really, really, really *really* want to preload these before the level begins rather than while pressing the key. Then you use an animationCounter to keep track of which to display and switch them out accordingly.

However, that being said. It would be a lot more efficient to store all those images within the same image (called a sprite sheet) and then update the SubRects of a Sprite to the different images, rather than changing image over and over.

Also, the above won't really do much - visually. You're not rendering the sprite, you're just loading all those images all at once and moving him all those steps all at once.

As for why they can't be loaded - have you double-checked that the path you gave is correct? (there's an m missing in Programming, for instance). Also - by using absolute paths like this - nobody else will ever be able to play your game unless they recreate that exact path structure. Try to use relative paths instead.

7
Feature requests / Shaders, vertex shaders?
« on: April 05, 2011, 11:32:49 am »
You could use Vertex Shaders in 2D-games to "wobble" sprites or tilt them, for instance. Implement something similar to Mode-7 (SNES) etc.

8
Feature requests / Shaders, vertex shaders?
« on: April 04, 2011, 09:08:57 pm »
You can still use vertex shaders the old-fashioned way if it's a show-stopper for you. :)

9
Graphics / sf::Sprite::SetImage - distorted rendering
« on: April 02, 2011, 03:39:57 pm »
Quote from: "Gibgezr"
You want to design for as few statechanges as possible (they are dreadfully slow in OpenGL)

I've worked with OpenGL for over a decade now, but thanks for the tips ;)

10
Graphics / not good image quality
« on: April 01, 2011, 09:01:59 am »
Shouldn't Bilinear filtering only apply when the size isn't 1:1 matched? Or is it pixel-offset related?

11
Graphics / sf::Sprite::SetImage - distorted rendering
« on: March 30, 2011, 03:19:11 pm »
Quote from: "Tank"
But for sf::Sprite it's not so obvious, because SetSubRect() is not an elemental feature (design-wise). In my opinion it's more like "I set this image, so I want to see this image." :)

I respectfully disagree.

Image as a sprite sheet seem the most natural connection to sf::Image from sf::Sprite - and it's far more maintainable to keep colour- or look-variations (for example: after grabbing a powerup) for the same sprite in different images and swap between them by setting a new image while maintaining subrects for say the current animation.

12
Graphics / sf::Sprite::SetImage - distorted rendering
« on: March 29, 2011, 08:47:44 pm »
set the adjustToNewSize parameter of SetImage to true instead of the default false?

Seems like intended behaviour to me.

13
System / timeGetTime() replacement?
« on: March 29, 2011, 05:58:07 pm »
Quote from: "Laurent"
sf::Clock is the time class, there's nothing else. Please give more details about your problem so that we can fix it (either in your code or in SFML).

There's also the window function to get time since last frame?

float sf::Window::GetFrameTime()

14
Graphics / simple private variable call problem
« on: March 29, 2011, 11:24:20 am »
In addition to what Groogy says - move your #pragma once to the top of the header-file.

15
Graphics / Image loading question
« on: March 27, 2011, 05:58:23 pm »
Perhaps separate Texture and Image? Although that would break a lot of existing code. Another option would be to subclass an ImageBuffer of sorts?

Pages: [1] 2 3 ... 9
anything