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

Pages: [1]
1
oops I didn't think what i was doing at all thanks

2
I'm making a buttonClick() function in a different class, I need to pass the window and event into the function from the main(), but when I try to get the position of the mouse in the window passed in the function, it gives me a error: no instance overloaded function sf::Mouse.getPosition matches the argument list, I have no idea what's going on, any help?

here is the code:
void screenManager::buttonClick(RenderTarget &window, Event &event) {
if (mouse.getPosition(window).x > startButtonText.getGlobalBounds().left && mouse.getPosition(window).x < startButtonText.getGlobalBounds().left + startButtonText.getGlobalBounds().width && mouse.getPosition(window).y > startButtonText.getGlobalBounds().top && mouse.getPosition(window).y < startButtonText.getGlobalBounds().top + startButtonText.getGlobalBounds().width - 250) {
    startButtonText.setColor(Color::White);
}
else {
    startButtonText.setColor(Color::Green);
}

if (mouse.getPosition(window).x > startButtonText.getGlobalBounds().left && mouse.getPosition(window).x < startButtonText.getGlobalBounds().left + startButtonText.getGlobalBounds().width && mouse.getPosition(window).y > startButtonText.getGlobalBounds().top && mouse.getPosition(window).y < startButtonText.getGlobalBounds().top + startButtonText.getGlobalBounds().width - 250 && event.type == Event::MouseButtonPressed && event.key.code == Mouse::Left) {
    display = false;
}

3
it's the full code now sorry if it looks a bit messy i'm still a beginner,

4
Run-Time Check Failure #2 - Stack around the variable 'font' was corrupted.
I don't get why my code is wrong, and I don't know what this means, any help?

int main()
{
       
        RenderWindow window(VideoMode(800,600), "SFML Game");  
        window.setFramerateLimit(60);        

        bool play = true;
        Event event;

        bool titleDisplay = true;

        Font font;
        if (font.loadFromFile("Data/arial.ttf") == 0) {
                return 1;
        }

        Text titleText;
        titleText.setFont(font);
        titleText.setCharacterSize(20);
        titleText.setColor(Color::Green);
        titleText.setPosition(240, 520);
        titleText.setString("hi");


        while(play == true){
               
               
                while (window.pollEvent(event)){
                        if (event.type == Event::Closed) {
                                play = false;
                        }
                        if (Keyboard::isKeyPressed(Keyboard::Escape)) {
                                play = false;
                        }
                }




                        Character.move();
                       

                        window.clear();
                   
                        window.draw(Character.mainRect);
                        if (titleDisplay == true) {
                                window.draw(titleText);
                        }

                        window.display();
               
        }

        window.close();
        return 0;
}

5
Graphics / Re: how do I create copies of sprite or shapes?
« on: April 11, 2016, 06:50:49 pm »
yes please an example would really be helpful, thank you

6
Graphics / how do I create copies of sprite or shapes?
« on: April 11, 2016, 03:35:36 pm »
I'm a beginner of sfml,  I'm currently making a game which involves shooting bullets, so I need to create copies of bullets, kind of like spawning them in, but i'm not entirely sure how to.

 I know it might be really simple, but I'm really stuck,  any help please? :-[

Pages: [1]