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.


Topics - 33pwnt33

Pages: [1]
1
Graphics / [SOLVED] Screen Capture Issue
« on: May 04, 2013, 07:50:40 pm »
Okay I know with sfml you can screen capture:
sf::RenderWindow Screen;
Screen.capture();
What I don't know is how to capture the whole entire screen and not just the application and how to save the screen capture to a file.

2
General / [Solved] SFML Game.exe has stopped working.
« on: April 27, 2013, 10:22:07 pm »
I don't think there is anything wrong with my code, because when I compile in visual studio express 2012 (release mode) there are no errors.  Though when I try too open the application it says: "SFML Game.exe has stopped working".

Here is my code:
#include <SFML\Graphics.hpp>
#include <Windows.h>
#include <iostream>

//Variables
bool appon,collision;
int PlayerX,PlayerY,speed;

sf::RenderWindow wind(sf::VideoMode(800, 600), "PwntGame");
sf::CircleShape Player(20.f);
sf::RectangleShape Object1(sf::Vector2f(100, 100));
sf::RectangleShape Object2(sf::Vector2f(100, 100));

int main()
{
        using namespace std;
        appon = true;
        speed = 25;

        PlayerX = 380;
        PlayerY = 280;

        collision = true;

        //Initialize Objects
        Object1.setFillColor(sf::Color::Blue);
        Object1.setPosition(100, 100);

        Object2.setFillColor(sf::Color::Blue);
        Object2.setPosition(300, 100);
       
        while(appon)
        {
                Sleep(speed);

                //If Escape Key down
                if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)){
                        wind.close();
                        Sleep(1000);
                        system("cls");
                        cout<<endl<<"Shutting down"<<endl;
                        Sleep(500);
                        appon = false;
                }

                //If Slash key down
                if(sf::Keyboard::isKeyPressed(sf::Keyboard::Slash)){
                        cout<<"0010101110101010101";
                        cout<<"1010001010111010111";
                        cout<<"1010101011101010010";
                }

                //Collision
                if(collision){
                if(PlayerY == 200 && PlayerX>60 && PlayerX<200){PlayerY = PlayerY = 201;cout<<"SHIFT + C to toggle collision"<<endl;}
                if(PlayerY == 60 && PlayerX>60 && PlayerX<200){PlayerY = PlayerY = 59;cout<<"SHIFT + C to toggle collision"<<endl;}
                if(PlayerX == 60 && PlayerY>60 && PlayerY<200){PlayerX = PlayerX = 59;cout<<"SHIFT + C to toggle collision"<<endl;}
                if(PlayerX == 200 && PlayerY>60 && PlayerY<200){PlayerX = PlayerX = 201;cout<<"SHIFT + C to toggle collision"<<endl;}

                if(PlayerY == 200 && PlayerX>260 && PlayerX<400){PlayerY = PlayerY = 201;cout<<"SHIFT + C to toggle collision"<<endl;}
                if(PlayerY == 60 && PlayerX>260 && PlayerX<400){PlayerY = PlayerY = 59;cout<<"SHIFT + C to toggle collision"<<endl;}
                if(PlayerX == 400 && PlayerY>60 && PlayerY<200){PlayerX = PlayerX = 401;cout<<"SHIFT + C to toggle collision"<<endl;}
                if(PlayerX == 260 && PlayerY>60 && PlayerY<200){PlayerX = PlayerX = 259;cout<<"SHIFT + C to toggle collision"<<endl;}

                if(PlayerX<1){PlayerX = 1;cout<<"You Are Not Permited in This Area"<<endl;}
                if(PlayerY<1){PlayerY = 1;cout<<"You Are Not Permited in This Area"<<endl;}
                if(PlayerX>759){PlayerX = 759;cout<<"You Are Not Permited in This Area"<<endl;}
                if(PlayerY>559){PlayerY = 559;cout<<"You Are Not Permited in This Area"<<endl;}
                }

                //Keydowns
                if(sf::Keyboard::isKeyPressed(sf::Keyboard::A)){PlayerX = PlayerX-1;}
                if(sf::Keyboard::isKeyPressed(sf::Keyboard::S)){PlayerY = PlayerY+1;}
                if(sf::Keyboard::isKeyPressed(sf::Keyboard::D)){PlayerX = PlayerX+1;}
                if(sf::Keyboard::isKeyPressed(sf::Keyboard::W)){PlayerY = PlayerY-1;}
                if(sf::Keyboard::isKeyPressed(sf::Keyboard::O)){speed = speed-1;}
                if(sf::Keyboard::isKeyPressed(sf::Keyboard::P)){speed = speed+1;}
                if(sf::Keyboard::isKeyPressed(sf::Keyboard::LShift) && sf::Keyboard::isKeyPressed(sf::Keyboard::C) || sf::Keyboard::isKeyPressed(sf::Keyboard::RShift) && sf::Keyboard::isKeyPressed(sf::Keyboard::C)){
                        Sleep(500);
                        if(collision){
                                collision = false;
                        }
                        else{
                                collision = true;
                        }
                }

                if(speed>50){speed = 47;}
                if(speed<5){speed = 8;}

                //Player stuff

                Player.setPosition(PlayerX, PlayerY);
                Player.setFillColor(sf::Color::Red);

                //Draw Everything
                wind.clear();
                wind.draw(Player);
                wind.draw(Object1);
                wind.draw(Object2);
                wind.display();
        }
    return 0;
}

Pages: [1]