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

Pages: [1]
1
Window / Re: One action per isKeyPressed
« on: September 28, 2014, 07:15:46 pm »
Thanks guys :)
I has was about the sf::EVenet::KeyPressed but did not understand how it worked , but did not see the tutorial either ><

2
Window / One action per isKeyPressed
« on: September 28, 2014, 05:43:09 pm »
Hello,

Here is the problem I have , I want to make something move from one lane to another , for that in a loop for window.isOpen() in the pollEvent loop I use this code , wich seemed pretty good to me :
            if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up)){
                player.moveLane(UP);
            }
            if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down)){
                player.moveLane(DOWN);
            }
 
But the problem here is that on the next occurence of the isOpen loop , it will try again to move , so the player moves twice , while pressing one key. So my idea was too make the player move one lane when pressing the key , how do you do that if this code doesn't work ?

And thhanks to anyone looking here :)

3
Graphics / Re: Texture loaded , drawn , but not shown on the screen
« on: May 28, 2014, 08:36:48 pm »
Just needed a re-build for it

4
Graphics / Re: Texture loaded , drawn , but not shown on the screen
« on: May 26, 2014, 07:29:43 pm »
Ok so If I have just my GPU activated I get a SIGSEGV in the SFML code Oo :

#0 ??   ?? () (??:??)
#1 68ED4511   sf::RenderTarget::applyBlendMode(this=0x28fcc0, mode=...) (C:\Users\qbsec_000\Desktop\SFML\src\SFML\Graphics\RenderTarget.cpp:431)
#2 68ED413C   sf::RenderTarget::resetGLStates(this=0x28fcc0) (C:\Users\qbsec_000\Desktop\SFML\src\SFML\Graphics\RenderTarget.cpp:362)
#3 68ED39C9   sf::RenderTarget::draw(this=0x28fcc0, vertices=0x5047f8, vertexCount=32, type=sf::TrianglesFan, states=...) (C:\Users\qbsec_000\Desktop\SFML\src\SFML\Graphics\RenderTarget.cpp:211)
#4 68EDD30B   sf::VertexArray::draw(this=0x28fc48, target=..., states=...) (C:\Users\qbsec_000\Desktop\SFML\src\SFML\Graphics\VertexArray.cpp:147)
#5 68ED3963   sf::RenderTarget::draw(this=0x28fcc0, drawable=..., states=...) (C:\Users\qbsec_000\Desktop\SFML\src\SFML\Graphics\RenderTarget.cpp:185)
#6 68EDA437   sf::Shape::draw(this=0x28fb7c, target=..., states=...) (C:\Users\qbsec_000\Desktop\SFML\src\SFML\Graphics\Shape.cpp:219)
#7 68ED3963   sf::RenderTarget::draw(this=0x28fcc0, drawable=..., states=...) (C:\Users\qbsec_000\Desktop\SFML\src\SFML\Graphics\RenderTarget.cpp:185)
#8 00401922   main() (C:\Users\qbsec_000\Traxys\Documents\Cpp\Programms\SFMLTest\main.cpp:24)

And AMD Catalyst says now that My drivers are bugged.....

EDIT : When I deactivated my AMD Car my laptop did a BSOD

5
Graphics / Re: Texture loaded , drawn , but not shown on the screen
« on: May 26, 2014, 07:15:35 pm »
My drivers could be wrong because I had problemens with them before(With a GPU that was not seen by my OS), but I have built SFML from the sources with MinGW , could It generate some problems ? And I am on a Laptop with the Graphical part of a CPU and a Radeon HD 7600M with up to date drivers. I am going to try deactivating one or the other.

6
Graphics / Re: Texture loaded , drawn , but not shown on the screen
« on: May 26, 2014, 12:29:09 am »
Ok know I am trying to figure out if the the texture is correctly put on a Sprite , but I can't figure out how to checks it , anyone has an idea how could I do it ?

7
Graphics / Re: Texture loaded , drawn , but not shown on the screen
« on: May 25, 2014, 10:32:31 pm »
The loading seems to be fine because this :

    if(!lavaFlow.loadFromFile("lavaFlow.png")){
        cout<<"Error"<<endl;
    }

doesn't print anything , but is the loading of a picture wich is 260*260 long take some time , or is it like 0.1 sec ?

EDIT : Nevermind ,even if the loading time was a bit long , It would not be over 23 minutes .....

8
Graphics / Re: Texture loaded , drawn , but not shown on the screen
« on: May 25, 2014, 10:21:32 pm »
Is there anything for checking that the texture is loaded ? Not going throught a sprite , just cheking if there is a texture like with checking a size that is the size of the file you defined it with (in pixel) or if a pixel RGB is equal to the one on the original picture , because my code is nearrly the minimal , + texture&sprite defined + clean/draw/display

9
Graphics / Re: Texture loaded , drawn , but not shown on the screen
« on: May 25, 2014, 09:35:56 pm »
Ok so looking at my code I understood the problem of it (for the event loop) , yeah my thing was in the wrong loop because it was being refreshed only on events so I bumped it little down , in the while window.isOpen() loop , but I still have a big black screen ........

Looking at the tutorials I saw the one on drawing shapes , so should I draw A ssquare and apply a texture to it instead ?

EDIT: Nevermind RectangleShape has the same problem, could it be the texture not loading properly ?

10
Graphics / Re: Texture loaded , drawn , but not shown on the screen
« on: May 25, 2014, 08:02:58 pm »
@eXpl0it3r

This doesn't do anything : My screen is still a big black box

11
Graphics / Re: Texture loaded , drawn , but not shown on the screen
« on: May 25, 2014, 07:58:34 pm »
Where should I put it for it to be refersehd  ??? ?

12
Graphics / Texture loaded , drawn , but not shown on the screen
« on: May 25, 2014, 06:33:20 pm »
I am coding a game , and just started some of the graphical part so I just started to try using SFML for it , but I had a bug where a sprite would not show on screen, so I tought that ther was bugs deep into my code , and so I made a fresh project with what could be considered like the most basic code to show a Sprite , but it is doing the same thing , and I can't understand why...

     Here is the basic code(even if you could guess it x) ):

#include <iostream>
#include <SFML/Graphics.hpp>

using namespace std;
using namespace sf;

int main(){
    RenderWindow window(VideoMode(500,500),"Test");

    Texture lavaFlow;
    lavaFlow.loadFromFile("lavaFlow.png");

    Sprite lavaFlowSprite;
    lavaFlowSprite.setTexture(lavaFlow);

    while(window.isOpen()){
        Event event;

        while(window.pollEvent(event)){
            if(event.type == Event::Closed){
                window.close();
            }
            window.clear();

            window.draw(lavaFlowSprite);

            window.display();
        }
    }
    return 0;
}

And few things to know , since I am compiling on Debug , some of the error shows , so I know that the Image has been loaded , and the image was firts in jpeg so I thank that it was maybe a type problem , so I converted it into png

Thanks to anyone who could help me !

Pages: [1]