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 - Tex Killer

Pages: 1 ... 11 12 [13] 14 15 ... 17
181
General / SFML Window not showing!!!
« on: December 25, 2011, 05:54:42 pm »
I havent saw that, sorry. Pyrius is right.

182
General / SFML Window not showing!!!
« on: December 25, 2011, 10:36:08 am »
Your Draw call should be out of the ifs. The rest of the logic depends on which version of SFML you are using.

If you are using SFML2, one new frame every 20 milliseconds should be about 50 frames a second. I don't know if this is the speed you are after.

If you are using SFML 1.6, the frame will be changed each 20 seconds, what I find strange.

By the way, your logic was correct this time, except for the Draw part.

183
General / SFML Window not showing!!!
« on: December 25, 2011, 01:53:43 am »
The code Pyrius gave now is very similar to the code I gave you earlier, but mine was for SFML 2.0.

Are you reading the documentation? About all of your answers are there, waiting for you to read.

184
General / SFML Window not showing!!!
« on: December 24, 2011, 06:50:13 pm »
Lets assume that your file have 30 frames, each 100px wide and 200px tall, so your image have width = 3000px, containing all the 30 frames, and height = 200px. You want to make a transition between all these frames with duration of 1 second.

It will be someting like this in current version of SFML 2:

Code: [Select]

...

sf::Clock Timer;
int CurrentFrame = 0;

while (App.IsOpened()) {
    if (Timer.GetElapsedTime() >= 1000 / 30) {
        CurrentFrame++;
        Timer.Reset();
    }
    YourSprite.SetSubRect(sf::Rect<int>(CurrentFrame * 100, 0, (CurrentFrame + 1) * 100 - 1, 200));
    App.Draw(YourSprite);
}

...


1000 / 30 is the aproximate duration, in milliseconds, of each frame. As you can see, you must manage the time and make the correct SubRect at each game loop iteration.

185
General / SFML Window not showing!!!
« on: December 24, 2011, 06:06:56 am »
We've been trying to teach you the logic behind it, so that you can make the code on your own. Giving working code might lead you to simply copy it without learning.

By the way, you don't need to learn shaders at all if you want to use SFML only. Of course, there are things that would not be possible without them, but the basics are provided just well by SFML.

186
General / SFML Window not showing!!!
« on: December 24, 2011, 02:14:01 am »
Viruses, to clear the screen every frame, use
Code: [Select]
App.Clear(sf::Color(red, green, blue))
About the if, lets see everyting from another perspective:

You must re-draw the "thing" every frame that the "thing" will appear on the screen. It is possible to make an if to check if the "thing" has already been hit, and you only re-draw it if still hasn't. Simply as that.

At the beggining the "thing" will be draw because it was not hit. When it is hit, the if makes the code not draw the "thing" and the "thing" will not be on the screen anymore, since you've already cleared the screen at the start of the current loop.

187
General / How to stop scrolling when player reach end of the map
« on: December 23, 2011, 05:59:39 pm »
Like this:

Code: [Select]
if ((App.GetInput().GetMouseX() <=100) && (View.GetCenter().x >= 1000))   View.Move(-Offset, 0);

I've just limited the left end, you can replicate it for the others.

188
General / SFML Window not showing!!!
« on: December 23, 2011, 04:37:29 am »
Make an if, and the sprite will only draw if the requeriments of the if are met.

189
General / SFML Window not showing!!!
« on: December 22, 2011, 11:18:50 am »
At every screen refresh (usually 60 per second), you must redraw everything on the screen. If you don't draw something, it will not be on the screen anymore.

190
General / SFML Window not showing!!!
« on: December 21, 2011, 02:27:34 am »
SFML does not handle animations. It handles resource loading, printing and some basic options. You should code the importing of an animation file, if you use one, and let SFML handle the printing of the correct frame at each screen refresh (wich is the correct frame is up to you, as well as where you get it from - here comes SubRect, of wich we talked about earlier).

What you are asking is for some high level features, but SFML is a low level library. All high level stuff should be made on top of SFML.

191
General / SFML Window not showing!!!
« on: December 20, 2011, 06:47:10 am »
Viruses, that effect combines particles with some image filters... by the looks of it, you seems pretty new to all of this. I think you should begin with easier things, like simple frame-based animations.

About your pixel doubts, a pixel is a point in an image. It is identified as two coordinates: X and Y. The 10, 10 pixel, as you've said, is the point located on the 10th column and 10th line of the image.

By the way, importing game content from external editors into your game (such as animations) should be handled by yourself, unless you use someone's engine instead of making one.

192
Window / sfml-window-d.dll is missing from my computer
« on: December 19, 2011, 06:29:02 am »
Try using
Code: [Select]
system("cd");
to know where your program is running from. In order to see the result you should compile the project as a console application.

193
Window / sfml-window-d.dll is missing from my computer
« on: December 19, 2011, 04:48:54 am »
bladelock, have you tried to put it on the project folder instead of Release?

194
General / SFML Window not showing!!!
« on: December 19, 2011, 01:49:56 am »
Viruses, I think you should try the first collision aproach described by Haikarainen, as you seem new to all of this.

About the SetSubRect, it is described on the tutorials. Basically, you'll make one big image with all the frames of your animation, put a subrect on the region of the image that have the current frame, and change the subrect when time is due for the next frames.

195
Graphics / Error with calling sf::Sprite
« on: December 18, 2011, 09:59:25 pm »
Sorry, it should be:

Code: [Select]
Title = new sf::Sprite(*ITitle);

Pages: 1 ... 11 12 [13] 14 15 ... 17