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

Pages: [1] 2
1
Graphics / Re: sf::Vertex V.S sf::Shape / sf::Sprite
« on: April 19, 2015, 07:49:20 pm »
Omg... That's what I should have done at first  :-X thanks

2
Graphics / Re: sf::Vertex V.S sf::Shape / sf::Sprite
« on: April 19, 2015, 05:55:36 pm »
Got it, thanks

3
Graphics / Re: sf::Vertex V.S sf::Shape / sf::Sprite
« on: April 19, 2015, 05:33:52 pm »
But despite sf::Sprite uses sf::Vertex[4] internally, sf::Vertex[4] should be faster, am I wrong?

4
Graphics / Re: sf::Vertex V.S sf::Shape / sf::Sprite
« on: April 19, 2015, 05:12:55 pm »
Well, I'm talking about sf::Vertex[4], forgot to mention.

Of course, shapes and sprites are easier to use, but not so fast as sf::Vertex[4] or sf::VertexArray would be, right? So, assuming that sf::Vertex[4] are faster and I can create my owns methods, can I prescind from sprites/shapes or would be it a mistake?

Thanks for reply


5
Graphics / sf::Vertex V.S sf::Shape / sf::Sprite
« on: April 19, 2015, 04:47:56 pm »
Hi, is there any reason to use sh::Shape or sf::Sprite instead of sf::Vertex and create your own class with your owns metods? Since sf::Vertex is more efficient, isn't it?

Regards

6
General discussions / Re: Android and iOS ports available for testing
« on: July 09, 2014, 08:05:39 am »
That guide uses CMake, so you tell it what compiler you want and it will generate the appropriate makefile/project file/whatever which you then use to do the actual compilation in whatever way is normal for your compiler.  It even gives the example that on Linux the actual compilation would be make && sudo make install.  For something like Visual Studio obviously you would open the project file and then tell VS to build the project.  Reading the official CMake tutorial might help: http://www.sfml-dev.org/tutorials/2.1/compile-with-cmake.php

I already compiled/built SFML with CMAKE, I mean how to compile my code for android apps to .apk? how to create a project, in code::blocks, for example.

7
General discussions / Re: Android and iOS ports available for testing
« on: July 09, 2014, 12:29:20 am »
https://github.com/SFML/SFML/wiki/Building-SFML-for-Android

To write some actual app, have a look at the Android example.

Yes, I followed this guide, but how to compile?

8
General discussions / Re: Android and iOS ports available for testing
« on: July 08, 2014, 10:23:07 pm »
Hi

I already built SFML-2.1 for android with mingw x32-4.8.1-posix-dwarf-rev3



It's all I need? I'm quite disorientated and I don't know how to compile my code for android


9
General / Is possible to force mouse to stay in sf::RenderWindow?
« on: January 18, 2014, 12:48:28 am »
Hi, I am learning OpenGL under SFML, and I am trying to move the 3D camera with mouse.

Is there any way to force the cursor to stay in the window? Since I can almost force it with the next code, but it doesnt work when you move the mouse so fast than the cursor can leave the window.

            case sf::Event::MouseMoved:
                // For camera rotation
                gradh += (event.mouseMove.x - (int)window.getSize().x/2)/7;
                grady += (event.mouseMove.y - (int)window.getSize().y/2)/7;
                // Force mouse to stay in the middle
                sf::Mouse::setPosition(sf::Vector2i(window.getSize().x/2,window.getSize().y/2),window);
                break;

Or another way to rotate the camera with mouse?

Sorry if bad english. Greetings

10
General discussions / Re: SFML 2.1
« on: July 28, 2013, 03:50:51 pm »
Quote
sf::Text just doesn't work unless you set the font
Yes, this is the expected behaviour. There's no more default font (already in 2.0).

I was able to use sf::Text without set a font in 2.0, lol, nvm.

What about the sf::Event::Closed issue? will be fixed soon?

EDIT: Another issue:

           case sf::Event::GainedFocus:
                std::cout << "The window gained focus." << std::endl;
                break;
            case sf::Event::LostFocus:
                std::cout << "The window lost focus." << std::endl;
                break;

sf::RenderWindow doesn't gain focus unless you click the titlebar, clicking inside the sf::RenderWindow doesn't work :/

Seems there's some bit issues with sf::Event, but at least, the taskbar bug has been fixed, nice fix, really.  ;)

Regards

11
General discussions / Re: SFML 2.1
« on: July 28, 2013, 01:49:50 am »
Hi, there's an issue with sf::Event in Win7 x64bits

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

int main()
{
    sf::RenderWindow window(sf::VideoMode(800,640,32),"My window");
    sf::Event event;

    while(window.isOpen())
    {
        while(window.pollEvent(event))
        {
            switch(event.type)
            {
                case sf::Event::Closed:
                    std::cout << "Don't close me! :(" << std::endl;
                    break;
                default:
                    break;
            }
        }
    }
}

ALT+F4 only returns sf::Event::Closed state when mouse cursor is outside of sf::RenderWindow

EDIT: Another issues:

  • sf::Text just doesn't work unless you set the font

12
General / Re: QT + SFML
« on: May 11, 2013, 10:16:26 pm »
Hi

No and yes. ;)

You can't use Qt in SFML, but you can use SFML in Qt. That is you can have a Qt widget that will act as a sf::Window where you can render to etc. but you won't be able to place buttons etc on top of the SFML part.
So if you want a GUI that surrounds your rendering part, then go for it, but if you want something like an in-game GUI, then you could take a look at the FAQ.

I'm using SFML2.0 integrated in a QWidget (Using Qt 4.8), and I'm able to place buttons and any others QWidgets over the QWidget which "inherit" the SFML texture, there is a code where I explain simply how I could do it:

SFMLV = new SFMLView(SFMLWidget, QPoint(0, 0), QSize(800, 640)); // Draw the SFML texture on the QWidget SFMLWidget
SFMLWidget->setLayout(mainLayout); // Draw mainLayout, where are some QWidgets over the SFML texture
setCentralWidget(SFMLWidget);
show(); // Show the QMainWindow

But I'm having a important problem: when I place, for example, a button on the SFML texture, it looks like this image, any QWidget over the SFML texture have a background which I'm able to change his colour, but I can't set it transparent (well, the background is transparent by default really, but it is like if the QWidget erase the SFML texture part which there's below, that's why the "Inventario" button and the char's name looks thus). Sorry if I couldn't explain my problem as I wish.

Another image

I'm searching how to solve this problem since 2 days ago but I can't find the answer. :(

I know that should be posted in Qt Forums, but I think that it can be interesting to learn how to solve it.

Sorry for bad english. Regards

13
It's works! :D Thanks you very much.

There is my code:

Client.hpp
#include <SFML/Network.hpp>
#include <iostream>
using namespace std;

class Client
{
    sf::IpAddress ServerAddress;
    sf::TcpSocket Socket;
    sf::Packet Packet;
    void Receiver();
    void Sender();
    bool connected;
    bool updated;
public:
    Client();
    sf::Thread R, S;
    sf::Packet Receive();
    void Send(sf::Packet);
    bool IsConnected();
    bool IsUpToDate();
};

Client.cpp
#include "Client.hpp"

Client::Client() : R(&Client::Receiver, this), S(&Client::Sender, this)
{
    cout << "Client is running!" << endl;
    ServerAddress ="**.**.**.**";
    Socket.connect(ServerAddress, *****);
    cout << "Client connected!" << endl;
    R.launch();
    S.launch();
}

void Client::Receiver() //Thread
{
    cout << "Receiver here!\n";
    while(1)
    {
        sf::Packet buffer;
        Socket.receive(buffer);
        cout << "Received!\n";
        Packet = buffer;
        buffer.clear();
        updated=false;
    }
}

void Client::Sender() //Useless Thread Yet (xD)
{
    cout << "Sender here!\n";
}

sf::Packet Client::Receive()
{
    updated=true;
    return Packet;
}

void Client::Send(sf::Packet Pack)
{
    connected = (Socket.send(Pack) == sf::Socket::Done);
}

bool Client::IsUpToDate()
{
    return updated;
}

bool Client::IsConnected()
{
    return connected;
}

14
Could you give me a example with sf::Thread please?  :-[

15
Like this?
Client::Client()
{
    sf::Thread R(&Receiver);
    cout << "Client running" << endl;
    ServerAddress ="**.**.**.**";
    Socket.connect(ServerAddress, *****);
    cout << "Connected" << endl;
}

I get the same error  :-\

Pages: [1] 2
anything