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

Pages: 1 [2] 3 4 5
16
Network / Port problems
« on: January 10, 2008, 05:08:44 pm »
Okay so I tried to create some small app to send and one to recieve small messages, but I'm not sure the client sends the message.  :?

server.cpp
Code: [Select]
#include <SFML/Network.hpp>
#include <SFML/Graphics.hpp>

#include <iostream>
       
sf::Mutex GlobalMutex;
bool ThreadRunning = true;
           

void ServerPoll(void* UserData)
{      
    GlobalMutex.Lock();
    std::cout << "Starting up Server." << std::endl;
    GlobalMutex.Unlock();
    sf::SocketUDP Server;
    Server.Bind(6739);
    sf::IPAddress ip(127,0,0,1);
   
    GlobalMutex.Lock();
    std::cout << "Finished setting up for Thread." << std::endl;
    GlobalMutex.Unlock();

    while(ThreadRunning)
    {
        char Message[128];
        std::size_t Received;
        GlobalMutex.Lock();
        std::cout << "Waiting for message." << std::endl;
        GlobalMutex.Unlock();
        if(!Server.Receive(Message, sizeof(Message), Received, ip));
            return;

        GlobalMutex.Lock();
        std::cout << "Message recieved." << std::endl;
        GlobalMutex.Unlock();


        GlobalMutex.Lock();
        std::cout << Message << std::endl;
        GlobalMutex.Unlock();
    }
    GlobalMutex.Lock();
    std::cout << "Finished thread." << std::endl;
    GlobalMutex.Unlock();

    GlobalMutex.Lock();
    std::cout << "Closing server." << std::endl;
    GlobalMutex.Unlock();
    Server.Close();
    GlobalMutex.Lock();
    std::cout << "Closed server." << std::endl;
    GlobalMutex.Unlock();
}

int main()
{
    sf::RenderWindow App(sf::VideoMode(800,600), "Target lul");

    sf::Thread Thread(&ServerPoll);

    bool Running = true;
    bool ThreadRunning = true;

    Thread.Launch();
    while(Running)
    {
        sf::Event Event;
        if(App.GetEvent(Event))
        {
            if(Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::Escape)
            {
                Running = false;
                ThreadRunning = false;
            }
        }

        App.Display();

    }
    return 0;
}


client.cpp
Code: [Select]
#include <SFML/Network.hpp>
#include <iostream>

int main()
{
    sf::IPAddress target(127,0,0,1);
    unsigned short port = 6739;

    sf::SocketUDP Client;
    Client.Bind(port);
    char Buffer[] = "HEYAHO :D:DDd.Dd:D";

    std::cout << "Sending message: " << Buffer << std::endl;

    if (!Client.Send(Buffer, sizeof(Buffer), target, port))
    {
        std::cout << "Msg fail" << std::endl;
        return 0;
    }

    Client.Close();
    std::cout << "Finished." << std::endl;

    return EXIT_SUCCESS;
}


Any ideas? The output I get from client.cpp is "Msg fail", so I guess I might have some parameters wrong.

17
Network / Port problems
« on: January 10, 2008, 04:03:36 pm »
Ahaa! Thanks. :D

I was also wondering, is there any way to make recieveing a packet an event? Or maybe I should put the networking in a new thread? :)

18
Network / Port problems
« on: January 09, 2008, 11:31:52 pm »
Code: [Select]
server.cpp: In function 'int main()':
server.cpp:25: error: no matching function for call to 'sf::SocketUDP::Receive(char [128], unsigned int, size_t&, sf::IPAddress&, short unsigned int&)'
/usr/include/SFML/Network/SocketUDP.hpp:107: note: candidates are: sf::Socket::Status sf::SocketUDP::Receive(char*, size_t, size_t&, sf::IPAddress&)
/usr/include/SFML/Network/SocketUDP.hpp:131: note:                 sf::Socket::Status sf::SocketUDP::Receive(sf::Packet&, sf::IPAddress&)


And when I remove the port parameter it says "please specify port". I'm really confused.

19
General discussions / [SOLVED] SFML 1.2 RC
« on: January 01, 2008, 10:28:07 pm »
I just updated to latest SVN (408 I think)

Code: [Select]
/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libsfml-graphics.so: undefined reference to `sf::Image::GetTexCoords(sf::Rect<int> const&) const'
collect2: ld returned 1 exit status


 :(
I'm not even using sf::Image (at this moment)

20
General discussions / [SOLVED] SFML 1.2 RC
« on: December 27, 2007, 02:40:09 pm »
Quote from: "Laurent"
This folder layout was a bit more convenient for me, but it really caused issues to people using SVN.

I just changed it, so that the public headers in /include will now always be up to date.


It works now, so I guess that fixed it. :) Thank you.

21
General discussions / [SOLVED] SFML 1.2 RC
« on: December 25, 2007, 03:49:51 pm »
Okay, so I've done the following in gentoo linux:

Code: [Select]
svn co https://sfml.svn.sourceforge.net/svnroot/sfml sfml
cd sfml
make
make install


Then, created a new file test.cpp, the code:


Code: [Select]

#include <SFML/Graphics.hpp>

int main()
{
  sf::Window App(sf::VideoMode(800,600,32), "Test");
 
  bool Running = true;
  while(Running)
  {
     App.Display();
  }

  return EXIT_SUCCESS;
}


It compiles just fine but I'm getting "Segmentation fault" when running it.  :(

(I did this just 3 minutes ago)

22
Feature requests / Gui package
« on: December 17, 2007, 11:06:57 pm »
Quote from: "DrEvil"
I've implemented guichan on top of SFML, which is a nice and very lightweight GUI library. It's not a fully skinnable and complex GUI system, but it's perfect for my needs. It has most of the normal GUI widgets(buttons, text boxes, text fields, radio buttons, check boxes, drop downs, windows, etc), and it's really easy to extend and add to, fast, and free of dependencies.

Heres some screens of my current usage.
http://www.omni-bot.com/wiki/index.php?title=Debug_Window


Have you got any example code?  :roll:

23
General discussions / [SOLVED] SFML 1.2 RC
« on: December 14, 2007, 04:44:53 pm »
Code: [Select]
make[1]: Entering directory `/root/sfml/src/SFML'
make[2]: Entering directory `/root/sfml/src/SFML/System'
g++ -o Clock.o -c Clock.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
g++ -o Lock.o -c Lock.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
g++ -o Randomizer.o -c Randomizer.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
g++ -o Sleep.o -c Sleep.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
g++ -o Unix/Mutex.o -c Unix/Mutex.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
g++ -o Unix/Platform.o -c Unix/Platform.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
g++ -o Unix/Thread.o -c Unix/Thread.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
g++ -shared -Wl,-soname,libsfml-system.so.1 -o ../../../lib/libsfml-system.so.1 Clock.o Lock.o Randomizer.o Sleep.o ./Unix/Mutex.o ./Unix/Platform.o ./Unix/Thread.o -lpthread
make[2]: Leaving directory `/root/sfml/src/SFML/System'
make[2]: Entering directory `/root/sfml/src/SFML/Window'
g++ -o Input.o -c Input.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
g++ -o OpenGLCaps.o -c OpenGLCaps.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
g++ -o VideoMode.o -c VideoMode.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
g++ -o Window.o -c Window.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
g++ -o WindowImpl.o -c WindowImpl.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
g++ -o Linux/Joystick.o -c Linux/Joystick.cpp -W -Wall -pedantic -fPIC -I../.. -DNDEBUG -O2
Linux/Joystick.cpp:36: error: expected constructor, destructor, or type conversion before 'namespace'
make[2]: *** [Linux/Joystick.o] Error 1
make[2]: Leaving directory `/root/sfml/src/SFML/Window'
make[1]: *** [sfml-window] Error 2
make[1]: Leaving directory `/root/sfml/src/SFML'
make: *** [sfml] Error 2


Using gentoo, gcc. Latest svn (362).  :(

24
General discussions / Need help to test the new joystick code
« on: December 07, 2007, 03:48:03 pm »
Windows XP, using Code::Blocks to compile the libs.

25
General discussions / Need help to test the new joystick code
« on: December 07, 2007, 01:23:43 pm »
Code: [Select]
-------------- Build: Release static_Win32 in sfml-window ---------------

Compiling: ..\src\SFML\Window\Win32\WindowImplWin32.cpp
G:\SFML\src\SFML\Window\Win32\WindowImplWin32.cpp: In member function `void sf::priv::WindowImplWin32::ProcessEvent(UINT, WPARAM, LPARAM)':
G:\SFML\src\SFML\Window\Win32\WindowImplWin32.cpp:748: error: `XBUTTON1' undeclared (first use this function)
G:\SFML\src\SFML\Window\Win32\WindowImplWin32.cpp:748: error: (Each undeclared identifier is reported only once for each function it appears in.)
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 0 warnings
 


 :?

26
General discussions / Need help to test the new joystick code
« on: December 06, 2007, 05:43:18 pm »
I'd try it, but the SVN doesn't agree with me. Dunno how to compile the libs. :(

27
Audio / No audiodevice found
« on: December 06, 2007, 05:40:03 pm »
Yes, I know, but it wasn't possible for this app.

28
Audio / No audiodevice found
« on: November 30, 2007, 05:23:44 pm »
Hey, I'm having some trouble distributing my programs with audio. The programs run fine, except for the fact that it gives the error "Audio device cannot be found." and no music starts playing.

I've added OpenAL32.dll to the exec dir.

Any ideas?

Edit: Add wrap_oal.dll to dir. Works.

Isn't there any way to do static linking? :<

29
Graphics / Scaling sprites
« on: November 30, 2007, 10:15:44 am »
Ahaa! Well, that's not any good. :(

30
Graphics / Scaling sprites
« on: November 30, 2007, 12:12:49 am »
Quote from: "Lord Delvin"
Combine a sprite with a counter I'd say...and as long as there isn't unicone support I hope there wont be such features.


But, unicode does work. :/

Combine with a counter?

Edit: Okay, I got it. Was using Scale before, I should have used SetScale.

Pages: 1 [2] 3 4 5