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

Pages: [1] 2
1
Graphics / Re: White box on startup
« on: February 11, 2013, 06:29:58 pm »
Wow....duh. Thanks for the help.

2
Graphics / White box on startup
« on: February 09, 2013, 03:39:14 am »
hello, probably something stupid I'm missing with this but I'm sure one of you smart people can help me out. Every time I start-up my game I get a small white box in the upper corner. It is only there for a split second, and one the game goes through a draw cycle it's gone, but it is still off-putting regardless. Basically I have my RenderWindow set to a certain video resolution, then I stretch it in 3X to get a pixel-y look. The white box is the actual video-resolution. Below I have some quick code so you can see what I mean.


#include <SFML/Graphics.hpp>
using namespace std;

int main()
{
    sf::RenderWindow window;
    window.create(sf::VideoMode(320, 240, 32), "test");
    //window.clear(sf::Color::Blue);//Thought I would try and through a clear in a number of points in the code
                                                      //Obviously, it didn't work
    window.setSize(sf::Vector2u(960,720));
    window.setPosition(sf::Vector2i(200,100));
    window.setFramerateLimit(60);
     while (window.isOpen())
     {
         sf::Event event;
         while (window.pollEvent(event))
         {
             if (event.type == sf::Event::Closed)window.close();
         }
     }
    return 0;
}
 

Thx for any quick fixes you may have
-Sam

3
Graphics / Re: Sprite Efficiency
« on: February 05, 2013, 02:18:01 am »
ok awesome ty

4
Graphics / Sprite Efficiency
« on: February 04, 2013, 06:44:53 am »
Hola, I was just wondering what, if any, implications creating sprites on the fly has. I would think creating a texture and sprite in the header and then just calling the sprite would be more efficient, but is it ok if I just make the texture in the header and then create sprites and set their parameters on the fly, letting the scope clean them up after every draw? Will this hit the performance enough where I should be worried about it? I prefer making them on the fly for header cleanliness but meh. Any thoughts you may have would be great.

-Sam

5
Graphics / Re: Changing Line Color?
« on: February 03, 2013, 07:33:03 am »
Haha it looks great, ty! ;D

6
Graphics / Changing Line Color?
« on: February 02, 2013, 10:54:33 pm »
So after some searching I found out how to draw a line...

sf::Vertex line[2] = {sf::Vector2f(x1,y1), sf::Vector2f(x2,y2)};
screen.draw(line , 2, sf::Lines);

OK easy enough, however this draws a white line. What if I want a line of a certain color or with a certain amount of transparency? I noticed RenderTexture.draw takes a another parameter, renderstate, from the documentation. Can someone explain how I might go about this. I've looked at the documentation for renderstate but still don't understand how I would go about using it in this case, if you use it at all.

Thanks for any help you can give
-Sam

7
Graphics / Re: A quick question about shaders...
« on: January 28, 2013, 05:29:02 am »
Hm... alright to the googlez I go. hopefully I can find what im looking for somewhere, or learn glsl from scratch lol. ty

8
Graphics / Re: A quick question about shaders...
« on: January 27, 2013, 11:05:47 pm »
My inability to scroll down in documentation is shameful lol. O.k. I think I can give a little better explanation of what I'm looking for. I need a postfx shader to apply to a Rendertexture that I have drawn everything to. I want it to be able to do color tinting, exposure, and glow kinds of effects. Would I have to write my own shader for this or is there an all-in-one shader floating around somewhere that I can just edit the params of?

9
Graphics / A quick question about shaders...
« on: January 27, 2013, 06:48:45 am »
Hola, was just a little confused about shaders and was hoping that maybe I could get some things cleared up. So right now I have a simple 2d game where I draw everything to a RenderTexture, display it and then display the RenderWindow with a shader parameter. (Example sorta below)

Not for compiling just for visualization

window.create(sf::VideoMode(320, 240, 32), "Example");   //RenderWindow
screen.create(window.getSize().x,window.getSize().y);      //RenderTexture
effects.setParameter("color", .1f,.9f,.5f);                             //change the effect of the shader?
shaderstate.shader = &effects;                                           //Applying shader to a RenderState

//Loop//
    window.clear(gray);
    screen.clear(gray);
    //draw some stuff to screen rendertexture
    screen.display();
    window.draw(sf::Sprite(screen.getTexture()),shaderstate);
    window.display();
//End Loop//

 

So everything runs fine but it seem the game isn't changed at all. In the many examples I have seen people load a .frag shader and set parameters to that. I'm wondering if there is a simple way to create a "clean slate" shader and just use the params you set to change the window? perhaps I'm missing the point of shaders or something but all I want to do is be able to apply things like a tint, some exposure, etc. Any help you can give is much appreciated.
-Sam

10
Graphics / Re: [2.0]Drawing Sprite AND Shape
« on: January 21, 2013, 01:37:28 am »
Haha after posting a while ago I just found I got the same problem. For me whatever sprite is drawn right after the Rectangle draw just gets screwed and doesn't show up. Hopefully someone can squash this bug. Updating my drivers now hopefully it'll fix it.

11
Graphics / Re: Controlling Game Speed on Different Computers
« on: January 14, 2013, 07:23:00 am »
I used a combination of the second last example in the article I linked and the setFrameratelimit to control the speed as well as cap it off so It only uses what processing power it really needs. It seems to be working pretty well.

12
Graphics / Re: Controlling Game Speed on Different Computers
« on: January 12, 2013, 05:19:55 am »
:/ damn that's all there is? But I want SFML to do it for me! lol ok tyvm

edit: I found this great article for controlling game speed and fps. Veterans and newbies alike should give it a read :)

http://www.koonsolo.com/news/dewitters-gameloop/

13
Graphics / Re: Controlling Game Speed on Different Computers
« on: January 11, 2013, 07:13:54 am »
But doesn't SFML contain its own Time functions? alas your right I'll do some more research tomorrow.

14
Graphics / Controlling Game Speed on Different Computers
« on: January 11, 2013, 06:06:47 am »
Hello there. I know this is a topic that is talked about a lot but I couldn't find too much about it in relation to SFML 2.0. So basically I just want to control the speed of my game so that it runs the same(and smoothly) on all machines. Right now my object moves at slightly different speeds depending on how fast my comp is running. I know about FrameLimiter but this only limits the amount of frames that are drawn it doesn't control game speed.

so I need...

Gameloop()
{
Input();
Update();
//do some check here
Draw();

//The Thinking functions need to be executed a certain number of times per second on every computer
//as long as these thinking function are caught up draw away!(within 60 fps)

}
 

I want to make it clear that I don't want a "velocity" fix. I really don't like this change in velocity depending on time solution. I would much rather have a fixed "time step"(as I've seen cleverly named in other posts) to my entire program.

So are there any functions or posts you could point me to to get this figured out? I don't need the logic so much as the code and syntax. I can figure it all out from there. :)

Thanks for any help you can give!
(Hopefully other people need this too, or don't know they need it till now ;) )



edit: I found this article http://www.koonsolo.com/news/dewitters-gameloop/ which gave me all the info I need gl!

15
Graphics / Re: "Internal OpenGL call" help
« on: January 10, 2013, 10:00:49 pm »
Oh cool thanks! Long live RAII  ;D

Pages: [1] 2