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

Pages: [1] 2
1
Graphics / Load image from file, scale it and save again
« on: February 15, 2012, 08:12:41 pm »
Quote from: "Tex Killer"
Ok, thanks for the information, but how can the GPU do smooth scaling in realtime with no aditional processing than using a pre-scaled image?

As far as I know, smooth scaling requires the calculation of average colors and stuff.

Sorry if I'm being annoying... I'm just curious and want my engine to run on most of the computers.

I think, and Laurent can correct me on this, that the reason why is because no matter what size the image is, it undergoes two transforms when it goes through the rendering pipeline, no matter what (i.e. even if the object is scaled to 1, it still undergoes the transform).

What goes on is that in CPU space, your image has translation, rotation, and scale matrices, but they aren't applied to the image. When you render the image, you pass these three matrices to the GPU. The GPU applies these matrices, transforming the image into "World Space," so that everything is relative to the origin. Later on in the process, your GPU takes your camera/viewport's parameters and transforms everything again so that it is relative to the view's position. That's the final image that you see.

So you can see, no matter what you do to the image itself, these transformations are going to be applied anyways.

2
Window / showing popups?
« on: February 07, 2012, 01:34:04 am »
I don't believe so. You'd probably be best served by finding a GUI library, and then integrating SFML into that.

3
Graphics / Converting Coords and moving with mouse issue [SOLVED]
« on: February 06, 2012, 07:28:37 pm »
Why do you have
Code: [Select]
this->Dest.x = (MousePos.x - this->GetSprite().GetPosition().x);
this->Dest.y = (MousePos.y - this->GetSprite().GetPosition().y);
?

It looks like you're creating a distance vector relative to the position of the sprite, but in your move function you're treating it like it was relative to the origin.

4
Window / Resizing window.
« on: February 05, 2012, 10:00:27 pm »
Yes, but take a look at this part:
Code: [Select]

// Create our own view (none of that sissy default stuff)
sf::View ourView;
ourView.Reset(sf::FloatRect(100, 100, 400, 200));
ourView.SetViewport(sf::FloatRect(0.f, 0.f, 1.f, 1.f));
Window.SetView(ourView);


Notice that we're calling two functions on ourView before we give it over to the window: Reset() and SetViewport().

SetViewport() allows us to tell the view how much of the RenderTarget (in this case, think window or form) that we want the viewport to take up. The viewport, incidentally, is what you are resizing.

Reset() lets us determine how much of the game world we want to show. In this case, our upper-left corner is (100,100) and we're showing a 400x200 box, which is why the rectangle (which is actually a square) appears distorted. Notice that this isn't a 400x200 pixel box, it is a 400x200 unit/meter/whateveryouwanttocallit box.

The reason that this is important is that it means that you can start defining the sizes and locations of everything relative to the size of your view, not the viewport. Once you do that, when someone messes with the window, the viewport will get scaled, and everything inside will only appear to scale, much like a real camera.

5
SFML website / Forums Need A search bar for looking for topics.
« on: February 05, 2012, 01:30:57 am »
On that note, it would be kinda nice if it could be moved somewhere that's easier for new people (the folks who will be using it anyways) to find.

6
Window / Window Not Opening
« on: January 26, 2012, 02:43:44 am »
Does it return anything? Or just it just sit there?

7
C / what should i do to compile csfml 2.0
« on: January 26, 2012, 02:42:00 am »
This is kind of a long shot, but are you running this with Admin rights? Program Files is supposed to be just for programs, and I think the default security settings might interfere.

8
C / what should i do to compile csfml 2.0
« on: January 26, 2012, 01:44:11 am »
Well, this is the that explained it to me, and which I highly recommend. Granted, it's for C++ instead of C, but I would think that it would be close enough...

Out of curiosity, why C instead of C++?

9
Window / logging a series of key presses
« on: January 25, 2012, 06:54:05 pm »
Sounds like you could just create a clock with the array, and reset the clock each time a keystroke is added to the array. If the clock is greater than 0.5s when the stroke is added, you flush the array before you add the keystroke.

If you know the length of all combos will be a certain length, you can use that to check to see whether a combo is being formed, or whether you just have junk values.

10
General / How do I make my sprite to shoot?
« on: January 23, 2012, 10:04:33 pm »
The cleanest way is probably to create an image outside of the bullet class, and then base all your sprite classes off that image (Each bullet object has a sprite variable and a position variable).

The most efficient way is probably to put the sprite in some sort of manager, and then each bullet just has a position. Then you have the manager draw each bullet using that one sprite.

Either method should work, I'm not sure which one is the better design decision in this case. I'd be tempted to go for the latter myself.

11
General / How do I make my sprite to shoot?
« on: January 23, 2012, 08:23:08 am »
Well, you technically don't need to have an individual sprite for each bullet. You could have a list of bullet objects with position vectors, and then draw the same bullet sprite at each location. I guess that'd save some memory at the expense of slightly more operations.

How do you know where your sprite is looking? If you're keeping track of that information with a vector, you can give your bullets a velocity vector based on that.

12
General / SFML installing on Visual Studio 2010 Professional
« on: January 23, 2012, 02:28:54 am »
Here is a that I have found to be immensely helpful for setting up SFML 2.0 in VS2010. It should walk you through the entire process.

13
General / Distributing SFML games on other websites.
« on: January 22, 2012, 02:23:57 am »
1) If your game is really good, and really polished (emphasis on really), you can talk to a publisher about getting it published. Chances are, it isn't at that stage, in which case you'll need to distribute it yourself. You can get your own web space, or you can look for a regular file hosting server to link to. I believe there is one dedicated to SFML projects.

2) As far as ads go, I guess you would need to find someone to pay you to display their ads (such as Google's AdSense). You'd need to work with the network package so that you can send a message out to the web and retrieve the ad and display it inside your game.

3) For distribution, it will depend on the platform. For windows, you really should go and learn how to make a windows installer so that they can install/uninstall your software. This will allow you to check for and install any .dll files you need (I suspect it would he ones for sound, but that's just a guess).

And of course, all of this stuff is online in articles published by people far more educated than myself.

14
Graphics / Jump doesn't realistically
« on: January 21, 2012, 06:29:57 pm »
Kinda what Mario said, you have a position and a velocity, so why not add an acceleration (which is how you'd calculate the effect of gravity anyhow), so now it is:
Code: [Select]
velocity.y += acceleration.y; // acceleration.y would be negative, while velocity.y would initially be positive.
position.y += velocity.y;

15
Window / sf::View isn't updated
« on: January 21, 2012, 10:15:22 am »
Out of curiosity, why did you guys make that change? Doesn't it mean that the window reallocates the view every time you modify the camera?

Pages: [1] 2