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

Pages: [1] 2
1
SFML projects / randballs
« on: May 19, 2018, 04:27:36 pm »
Hi guys !
I did this little playground and I will continue add features, as by now is pretty simple: Each ball randomly changes its color. On collision if they have the same color they merge, otherwise bounce.

It uses EnTT for entity management and all other engine classes are made by me ( Hope it could help someone ;) )

Link to source code

Updated video:
video link

2
Window / handle input while window is in background
« on: June 29, 2013, 12:29:21 pm »
hi all.

it is possible handle an input ( key press , mouse click  , and so so.. ) while sf::renderWindow is in background ?


with this code doesn't work

                sf::Event event;
                while ( window.pollEvent(event) )
                {
                        if ( event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::L  )
                        {
                              // do things
                        }
                }



it is work ony if window is focussed ! any idea ? ty in advance

C++ - sfml 2 -  visual studio 10 & 12 - OS: windows 7

3
Graphics / [Isometric] dont draw correctly ( black lines ? )
« on: December 11, 2012, 02:33:55 pm »
Simple question:


I have my isometric map that i initialize in this mode:

        for (int i = 0; i < Xmapsize; i++)
                 for (int j = Ymapsize - 1; j >= 0; j--)
                 {
                        tile_map[i][j].setTexture(texture);
            float x = (j * tile_width / 2) + (i * tile_width / 2);
            float y = (i * tile_height / 2) - (j * tile_height / 2);

                        tile_map[i][j].setPosition(x,y);
                 }



and i draw it in the simplest mode possible:

                for (int i = 0; i < Xmapsize; i++)
                        for (int j = Ymapsize - 1; j >= 0; j--)
                                window.draw(tile_map[i][j]);



Any1 know why in my map there are some orrible black lines ?

This is the image:





Ty in advance!


some stuff: sfml 2, visual studio 10 , the error persist in debug n release mode

4
Graphics / sf::FloatRect & performance
« on: November 23, 2012, 03:24:28 pm »
I have this code, in my draw function:

        view->setCenter(_player->getPosition());
        window.setView(*view);

        _map->draw(window,view->getViewport());


and in _map the draw  is

void TileMap::draw(sf::RenderWindow &window, const sf::FloatRect &_camerarect)
{
        unsigned int tilesdraw(0);
        for ( int i = 0; i< mapW ; i++ )
                for ( int j = 0; j<mapH; j++ )
                        if ( _camerarect.intersects(tiles[i][j]->getGlobalBounds()) )
                        {
                                window.draw(*tiles[i][j]);
                                tiledisegned++;
                        }
        std::cout<<"Tiles drawed: "<<tilesdraw<<std::endl;
}



I made that for draw only the tiles that are in the window, but its not work ( at least not draw anything ), any ideas whats I wrong?


sfml2, visual studio c++ 2010.

5
Window / [sfml2]Mouse pos in 2d world! [SOLVED]
« on: October 25, 2012, 12:15:53 am »
I need to rework my classes for update my little engine but today i'm encountered in an error:


I run those "check" codes for finding the position of the mouse and :

This show the position of the mouse on desktop
sf::Vector2i mousepos = sf::Mouse::getPosition();

This show the position of the mouse on window
sf::Vector2i mousepos = sf::Mouse::getPosition(window);


But what code need I to run for know what is the position of the mouse on my 2D world ?


For example, now the funtion return that my mouse is on position (0,0) (i placed it at left-top) but in my world it's in position (213,352);
How can I find the 2D coords position of mouse with a sf::(mouse ?)::function ?

sfml2 lastest release and windows 7
ty!

6
Network / send() always != socket.Done
« on: October 15, 2012, 02:15:10 am »
Hi, i just try to run the code found in the doc for TCP server/client.

 ----- The client -----

 // Create a socket and connect it to 192.168.1.50 on port 55001
 sf::TcpSocket socket;
 socket.connect("myOnlineIP", 55001);

 // Send a message to the connected host
 std::string message = "Hi, I am a client";
 socket.send(message.c_str(), message.size() + 1);

 // Receive an answer from the server
 char buffer[1024];
 std::size_t received = 0;
 socket.receive(buffer, sizeof(buffer), received);
 std::cout << "The server said: " << buffer << std::endl;

 // ----- The server -----

 // Create a listener to wait for incoming connections on port 55001
 sf::TcpListener listener;
 listener.listen(55001);

 // Wait for a connection
 sf::TcpSocket socket;
 listener.accept(socket);
 std::cout << "New client connected: " << socket.getRemoteAddress() << std::endl;

 // Receive a message from the client
 char buffer[1024];
 std::size_t received = 0;
 socket.receive(buffer, sizeof(buffer), received);
 std::cout << "The client said: " << buffer << std::endl;

 // Send an answer
 std::string message = "Welcome, client";
 socket.send(message.c_str(), message.size() + 1);





And now my question: I don't understand why the send function failed all time. ( != sock.done ).
But if I use loopback IP the program work fine.

I tried to disable antivirus,firewall and router tcp socket check but the issue still continue.


Any1 got suggestion for solve this problem ? :)


Info: ( lastest sfml 2 version, windows 7 )

7
Graphics / flip image
« on: June 19, 2012, 11:55:20 am »
on my spritesheet I have the sprites that look to the right.

There is a fast mode to add the function to flip in SFML 2 ? ( MVC++ 10 )


for example:

in state "Run" i would to create something like:

if ( !isFlipped)
    sprite.setTextureRect(sf::IntRect(50*ActualXframe,50*ActualYframe,50,50))
else
 // select same textureRect But flipped.. how can i do this ?




Ty in advance :)

8
Graphics / [sf::Text] Error in lastest version
« on: May 06, 2012, 05:39:33 pm »
Hi guys..  I have a problem

The error is in the Debug mode, in Release is all ok.

Compiling this code:

 #include <SFML/Graphics.hpp>
 #include <boost\shared_ptr.hpp>
 
 int main(void)
 {
         sf::RenderWindow *window= new sf::RenderWindow(sf::VideoMode(800, 600), "SFML window",sf::Style::Close);
       
         sf::Text testo;
         
         testo.setPosition(200,200);
         testo.setString("Hello World");

     while (window->isOpen())
     {
         sf::Event event;
         while (window->pollEvent(event))
         {
             if (event.type == sf::Event::Closed)
                 window->close();
         }
         
                 window->clear();
                 
                 window->draw(testo);

                 window->display();
     }
 
     return 0;
 }

I got this error

Code: [Select]
1>main.obj : error LNK2001: extern symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)

The error is on the call of "window->draw(testo)", how can I solve ?

Ty !  :D

9
Graphics / [sf::Texture] Load from buffer
« on: May 02, 2012, 05:43:46 pm »
Hi guys!
I need your help, i hope i can find the solution!  ;)
I load from mysecretfile.dat my images in binary ( ios::in | ios::binary  | ios::ate ).
Im going to load first image and i have it in a  char *buffer.


How can  I export the "buffer" in a sf::Texture?

10
SFML projects / New Project, need programmers and graphics
« on: March 29, 2012, 05:11:47 pm »
Technical Specifications:  MVC++2010 - SFML 2.0

Introduction to the game:

Game with a top view ( 2D ) it will be like  an mmo.
just logged in, players is in the main room.  The main room contains merchants (clothing and weapons) and those that will make access to the rooms PvP / PvE.


PvE = A group generated randomly (or not) will be carried in one of several instances. The goal is to kill all the mobs and the final boss (which will have rewards). But be careful! Friendly fire is on!

PvP = Usual way, will be better defined with the trend of development of the game.


Currently we are only a programmer and a graphic. We are willing to accept anyone with a minimum of skill in the field who wants to participate in.


Enjoy!

11
System / Thread issues
« on: March 19, 2012, 10:39:30 pm »
Hi guys!

I need to have in "par" my game with the Listen socket on my client.

Now, i'll try to do somwhat like this but doesn't work!

Someone can help me?

Code: [Select]
void ThreadFun(void *UserData)
{
Network->work();
}

int main()
{
Game* game= new Game();

sf::Thread Threads(&ThreadFun);

Game->work();

    return EXIT_SUCCESS;
}



Info -> the thread starts much after commencing the game
( Before i need to send/recv singles datas in another methods. )
SFML 2.0 , vc++2010

12
Network / just a query!
« on: January 30, 2012, 07:36:07 pm »
i need, for my highscores online, send to my database some data.

Then, i really dont know how i can do this.. I thought something like my program send the data to my php page and the page send the query ( i know how to send a query in php ).. its possible? starch could someone help me? perhaps with an example? the documentation did not help me! thank you!

13
Graphics / sf::Sprite -> Move and SetPosition
« on: January 18, 2012, 03:58:39 pm »
what are the differences and when to use the first than the second ( or the second then first ) in my game loop?

14
Graphics / [sfml 2] Take the text of the user.
« on: November 22, 2011, 08:21:47 pm »
Hi guy!
I have a doubt!
In my game I need to ask for the name of the player.
How do I take (and visualize) the name of the player?

For example:

-- step 1 --
the player type "S"
On the screen : S
-- step 2 --
the player type "F"
On the screen : SF
-- step 3 --
the player type "M"
On the screen : SFM
-- step 4 --
the player type "L"
On the screen : SFML
-- step 5 --
the player type "Enter"
i save "SFML" in a std:: ( or sf:: ) string called "NamePlayer".



got it?


Soz for my orrible eng!
B!

15
Window / How to choose better Fullscreenmode!
« on: October 31, 2011, 10:03:09 pm »
Little problem in 1.6:


I have two monitors (one smaller and one bigger). into smaller ones, you can clearly see the images but int  the big one you see a little blurry ..

how can I help in selecting the program the "better "resolution (in any screen you are using)?



Soz for my eng b!

Pages: [1] 2