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

Author Topic: SFML Window not showing!!!  (Read 35539 times)

0 Members and 1 Guest are viewing this topic.

Viruses

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
SFML Window not showing!!!
« Reply #15 on: December 18, 2011, 04:39:07 am »
I tried building SFML 2.0 and it was too hard. I got errors and stuff..

Viruses

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
SFML Window not showing!!!
« Reply #16 on: December 18, 2011, 08:08:14 am »
Nevermind got SFML 2.0 to work and it solved the issue. However , there arent many SFML tutorials out there on topics like animation or collistion detection. If you know where i could find basic tutorials BUT ALSO it goes to an advanced level then please let me know.

Haikarainen

  • Guest
SFML Window not showing!!!
« Reply #17 on: December 18, 2011, 09:06:40 pm »
Quote from: "Viruses"
Nevermind got SFML 2.0 to work and it solved the issue. However , there arent many SFML tutorials out there on topics like animation or collistion detection. If you know where i could find basic tutorials BUT ALSO it goes to an advanced level then please let me know.


Dont look for SFML specific tutorials for functions that SFML doesn't directly offer.

For animation; Create a resourcemanager to store images/tiles/animations, use timers , textures(from your resuorcemanager) and sprites to make the magic happen.

For collisiondetection; Either use boxes and check intersection(sf::Rect::Intersects() offer this functionality directly, its easy to do it by yourself however), use circles, OR cache the textures on init and create a collisionmap based off alpha (2d-bool-array is good), and then check them pixels.

Good luck!

Viruses

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
SFML Window not showing!!!
« Reply #18 on: December 19, 2011, 12:29:11 am »
Well i don't really get frame based animation. I can't find a good tutorial on how to use SetSubRect() for frames. And for collision i can just check if the position is intersecting with another position and then go from there. But the animation part i don't get how to do.

EDIT: I don't get how to do pixel stuff. So how do you even acess pixels?

Tex Killer

  • Full Member
  • ***
  • Posts: 242
    • View Profile
SFML Window not showing!!!
« Reply #19 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.

Viruses

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
SFML Window not showing!!!
« Reply #20 on: December 19, 2011, 10:36:31 pm »
I understand WHAT to do for frame based animation. The only thing i don't get are the parameters. So on the tutorials it said from pixel 10,10 to pixel 20,20 or something. I absolutely didn't get the pixel part. So the parameters confused me.

Viruses

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
SFML Window not showing!!!
« Reply #21 on: December 20, 2011, 03:27:57 am »
I know this might sound a little noob but i really need a good and basic explanation. This has to do with shaders. First of all, what are shaders? I really need a basic explanation starting from like literally scratch cause the only thing i know about them is that theyre important in game programming and that they have to do with graphics. Second of all , how do you begin to program shaders for your SFML projects? If theres a good beginnner tutorial, please say. And last of all(not really with shaders, or maybe it is) is there any way to import animations or cool effects in SFML? I mean IMPORT, not CODE so make them in another software then import to SFML. If there isn't then how do you do special effects? A really really good example of what i might want is : http://www.youtube.com/watch?v=jDhVwx7bBS4 .    These are like the main questions i've had for some time so please reply and thanks a ton!

Tex Killer

  • Full Member
  • ***
  • Posts: 242
    • View Profile
SFML Window not showing!!!
« Reply #22 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.

Viruses

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
SFML Window not showing!!!
« Reply #23 on: December 20, 2011, 10:56:58 pm »
I've often said this in other forums or places. When i ask about effects and advanced topics and how to do it, i dont mean im going to start on that advanced a level just as a beginner. Im obviously going to start with frame based animation. I just wanted to know as a heads up so in the future i could do it. And what is an image filter? And you said i should handle animation from external software by myself. Well, i don't know what file formats SFML can use for animations. So how would i go about doing that? Because in my opinion making an animation in a software meant especially for animations is going to be better than coding the animation. And as i said earlier, i will start with frame based but id still like to know. Thanks again!

Tex Killer

  • Full Member
  • ***
  • Posts: 242
    • View Profile
SFML Window not showing!!!
« Reply #24 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.

Viruses

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
SFML Window not showing!!!
« Reply #25 on: December 21, 2011, 09:58:20 pm »
And how exactly should i go about doing that?(not the code please, just the theory or explanation)

Viruses

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
SFML Window not showing!!!
« Reply #26 on: December 21, 2011, 10:44:42 pm »
Actually ill worry about shaders later. First, i have a problem with sprites. When making a game where you want a sprite to disappear with an effect or  just disappear when a bullet hits it or something, how do you delete it in runtime? Is there a special function that automatically deletes the sprite when called?

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
SFML Window not showing!!!
« Reply #27 on: December 22, 2011, 05:18:43 am »
You delete the sprite by not drawing it.
I use the latest build of SFML2

Tex Killer

  • Full Member
  • ***
  • Posts: 242
    • View Profile
SFML Window not showing!!!
« Reply #28 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.

Viruses

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
SFML Window not showing!!!
« Reply #29 on: December 23, 2011, 12:37:21 am »
Ok... But how would you tell it that? Thats what im asking. Is there a special function that does opposite of:

Code: [Select]


screenameorwatever.Draw(spritename);




In this case a sprite is drawn on the screen.
But is there a function that would undraw the sprite from the screen or something?