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

Pages: [1]
1
Window / Re: Change the Window design
« on: March 25, 2016, 02:07:42 am »
ah ok thank you :(

2
Window / Change the Window design
« on: March 24, 2016, 11:20:35 pm »
Hello guys,
I wanted to ask is it possible to make a another design of the window like Steam (I read that Steam was written in c++ and SDL, cause of this I thaught it must be possible to change the design) or do you know how they did this?

3
Graphics / Re: sf::RenderTexture positioning?
« on: March 13, 2016, 07:51:35 pm »
I want to make my own Paint and the position of the "drawing surface (RenderTexture) " should be in the middle of the window. Problem solved.

4
Graphics / sf::RenderTexture positioning?
« on: March 13, 2016, 07:24:50 pm »
Hello guys,
I wanted to ask you if its possible to positioning the sf::RenderTexture the default position is always at 0,0

5
General / Bind with Atom
« on: February 13, 2016, 01:02:15 pm »
Hey guys,
Im using the editor Atom for my c++ projects i wanted to ask you how can I bind SFML with Atom.

6
Graphics / playing Animations or GIFs
« on: January 25, 2016, 02:05:53 pm »
Hello guys,
is it possible to PLAY animated gifs or animations who are created in "Spriter" or another animation creator progamm in C++ SFML code ?

7
General / binding window with texture in different classes
« on: August 15, 2015, 03:11:03 pm »
Hey guys,
if my english is not so good sry and if i say something wrong its because im a newbie in c++ and sfml
so my question is how can i put the SpriteTexture in the draw function that is in a other class


main.cpp
#include <iostream>

#include <SFML\Graphics.hpp>

#include "Player.h"
#include "GameWindow.h"


int main()
{

        GameWindow runWindow;
        runWindow.RunGameWindow();

        return 0;
}

Player.h
#ifndef PLAYER_HPP
#define PLAYER_HPP

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

#include "GameWindow.h"

class Player
{
public:
       
        void CreatTexture();
        void PlayerMovement();

       


private:

        sf::Texture PlayerTexture;
        sf::Sprite  PlayerSprite;
};

#endif
 

Player.cpp
#include "Player.h"

void Player::CreatTexture()
{
        if (!PlayerTexture.loadFromFile("Picture//rgs.png"))
        {/*----------*/ }

        PlayerSprite.setTextureRect(sf::IntRect(40, 0, 20, 18));
       
}



void Player::PlayerMovement()
{
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::A))
        {
                PlayerSprite.move(0.1 , 0);
                PlayerSprite.setTextureRect(sf::IntRect(140, 0, 40, 40));
        }


        if (sf::Keyboard::isKeyPressed(sf::Keyboard::D))
        {
                PlayerSprite.move(-0.1 , 0);
                PlayerSprite.setTextureRect(sf::IntRect(100, 0, 20, 30));
        }
}
 

GameWindow.h
#ifndef GAMEWINDOW_HPP
#define GAMEWINDOW_HPP

#include <SFML\Graphics.hpp>
#include "Player.h"


class GameWindow
{
public:
        GameWindow();
        ~GameWindow();

       
       
        void RunGameWindow();
        void Draw();
        void Render();
       


private:
        sf::RenderWindow *mainWindow;
        sf::Event        *mainEvent;
};

#endif

GameWindow.cpp
#include "GameWindow.h"


GameWindow::GameWindow()
{
        mainWindow = new sf::RenderWindow(sf::VideoMode(800, 600, 32), "Red Ghost", sf::Style::Titlebar);
        mainEvent  = new sf::Event;
}


GameWindow::~GameWindow()
{
        mainWindow = NULL;
        mainEvent = NULL;

        delete mainWindow;
        delete mainEvent;
}


void GameWindow::RunGameWindow()
{

        while (mainWindow->isOpen())
        {

                while (mainWindow->pollEvent(*mainEvent))
                {/*----------*/
                }

                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
                {
                        mainWindow->close();
                }


                Render();
        }

}

void GameWindow::Draw()
{
        /*I want put the PlayerSprite in this function or draw the PlayerSprite
        on the window*/

}

void GameWindow::Render()
{
        mainWindow->clear(sf::Color::White);
        Draw();
        mainWindow->display();
}
 

you guys can give me a other example too if this is to much
thanks

8
Hey guys,
this is my first time I write in forum i have the problem: if i always want to draw something there comes the error: 1>main.cpp(21): error C2661: 'sf::RenderTarget::draw' : no overloaded function takes 0 arguments

i know im a newbie with programing

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




int main()
{
        sf::RenderWindow window(sf::VideoMode(800, 600, 32), "JaR", sf::Style::Titlebar);
        sf::Event mainEvent;
       
        sf::Texture texture;
       
        if (!texture.loadFromFile("nicogang.png"))
        { /*----*/ }


        while (window.isOpen())
        {
                while (window.pollEvent(mainEvent))
                {/*-----*/}
               
                if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
                {return 0;}

                window.clear();
                window.draw(texture);
                window.display();

        }

        return 0;
}

Pages: [1]