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

Pages: [1]
1
Window / Cursor Position
« on: June 13, 2014, 12:45:04 pm »
How can I get cursor position on my window or get position of window?
For example, I have screen resolution 1920x1080 and window 1280x720. My cursor position can be 1440x1050 and its bad... So, how can I get cursor position when CursorX <= 1280 and CursorY <= 720?

2
Graphics / Rotation Center
« on: June 11, 2014, 12:36:26 pm »
Hi! How can I set the rotation center of my sprite?

3
Graphics / dynamic arrays with circleshapes
« on: June 06, 2014, 02:11:59 pm »
Hello, here is my code. Im trying to write the programm which puts circleshapes on cursor position. I must use dynamic arrays. Could you say me, whats wrong and why my programm doesnt work? Thank you very much
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>

using namespace sf;
using namespace std;

RenderWindow app;

class CS
{
public:
        CircleShape *items;
        int size;

        void Add() {
                size++;
                CircleShape *newArray = new CircleShape(size);
                for (int i = 0; i < size - 1; i++)
                        newArray[i] = items[i];
                items = newArray;
                items[size - 1].setFillColor(Color::Blue);
                items[size - 1].setRadius(20);
        }
};
CS circleShape;
int main()
{      
        float xResolution = VideoMode::getDesktopMode().width;
        float yResolution = VideoMode::getDesktopMode().height;
        app.create(VideoMode(xResolution, yResolution), "1", Style::Fullscreen);
        while (true)
        {
                app.clear(Color::White);
                if (Keyboard::isKeyPressed(sf::Keyboard::D))
                {
                        circleShape.Add();
                        int mouseX = Mouse::getPosition().x, mouseY = Mouse::getPosition().y;
                        circleShape.items[circleShape.size - 1].setPosition(mouseX, mouseY);
                        for (int i = 0; i < circleShape.size; i++)
                                app.draw(circleShape.items[i]);
                }
                app.display();
        }
        return 0;
}

Pages: [1]
anything