Window procedure

Hi

I’m making a game using Winsock and SDL… the problem is that i don’t know
how to put this in my code:=========================================
in window procedure:
switch (msg) {
case YOUR_SOCKET_MSG:
switch (WSAGETSELECTEVENT(lParam)) { // Differentiate between the
events
case FD_READ:
// Receive data
break;
case FD_WRITE:

Found on http://www.hal-pc.org/~johnnie2/winsock.html
=========================================
I’ve tried to make like they do on this website
http://world.std.com/~jimf/papers/sockets/winsock.html#Figure_4 but when i
try the game there’s nothing that appear…

Please Help Me =(
Thanks.

hello,

i use SDL_Net instead of winsock, it is very similar in operation (since
most socket implementations are all very similar). If you use SDL_Net
instead of winsock, you will also have the benefit of not having to recode
your network code if you want to port your game to another OS!> ----- Original Message -----

From: lud2k@hotmail.com (Lud2k)
To:
Sent: Friday, April 18, 2003 3:32 PM
Subject: [SDL] window procedure

Hi

I’m making a game using Winsock and SDL… the problem is that i don’t
know
how to put this in my code:

in window procedure:
switch (msg) {
case YOUR_SOCKET_MSG:
switch (WSAGETSELECTEVENT(lParam)) { // Differentiate between the
events
case FD_READ:
// Receive data
break;
case FD_WRITE:

Found on http://www.hal-pc.org/~johnnie2/winsock.html
=========================================
I’ve tried to make like they do on this website
http://world.std.com/~jimf/papers/sockets/winsock.html#Figure_4 but when i
try the game there’s nothing that appear…

Please Help Me =(
Thanks.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

SDL_Net doesn’t use the SDL-events; ie. you have
to treat network code different from mouse-events
or any other events. There is a library called
Net2 though, which builds ontop of SDL_Net, which
use the SDL-event paradigm. And it’s got great
documentation:

http://www.gameprogrammer.com/net2/net2-1.html

In Net2 a network event such as “someone is trying
to connect” is received by a SDL_Event, so you can
put the network code directly beside the other
SDL-event code.

/Olof

Atrix Wolfe: “Re: [SDL] window procedure” (2003-04-19 19:23)

#hello,#
#i use SDL_Net instead of winsock, it is very similar in operation (since
#most socket implementations are all very similar). If you use SDL_Net
#instead of winsock, you will also have the benefit of not having to recode
#your network code if you want to port your game to another OS!

#----- Original Message -----
#From: “Lud2k”
#To:
#Sent: Friday, April 18, 2003 3:32 PM
#Subject: [SDL] window procedure

#> Hi
#>
#> I’m making a game using Winsock and SDL… the problem is that i don’t
#know
#> how to put this in my code:
#> =========================================
#> in window procedure:
#> switch (msg) {
#> case YOUR_SOCKET_MSG:
#> switch (WSAGETSELECTEVENT(lParam)) { // Differentiate between the
#> events
#> case FD_READ:
#> // Receive data
#> break;
#> case FD_WRITE:
#> >> Found on http://www.hal-pc.org/~johnnie2/winsock.html
#> =========================================
#> I’ve tried to make like they do on this website
#> http://world.std.com/~jimf/papers/sockets/winsock.html#Figure_4 but when i
#> try the game there’s nothing that appear…
#>
#> Please Help Me =(
#> Thanks.
#>
#>
#>
#>
#> _______________________________________________
#> SDL mailing list
#> SDL at libsdl.org
#> http://www.libsdl.org/mailman/listinfo/sdl

#_______________________________________________
#SDL mailing list
#SDL at libsdl.org
#http://www.libsdl.org/mailman/listinfo/sdl

“Olof Bjarnason” ha scritto nel messaggio
news:Pine.SOL.4.30.0304201222320.22148-100000 at grosse.mdstud.chalmers.se

SDL_Net doesn’t use the SDL-events; ie. you have
to treat network code different from mouse-events
or any other events. There is a library called
Net2 though, which builds ontop of SDL_Net, which
use the SDL-event paradigm. And it’s got great
documentation:
http://www.gameprogrammer.com/net2/net2-1.html

In Net2 a network event such as “someone is trying
to connect” is received by a SDL_Event, so you can
put the network code directly beside the other
SDL-event code.

Does Net2 work under Win32 ??
I think it doesn’t work because under Win32 you can’t use eventthreads…–
Bye

It is true that Win32 does not support the event
thread (INIT_EVENTTHREAD) but this is not
mandatory to use NET2. Simply remove all
INIT_EVENTTHREADS from server.cpp etc. and
recompile…

I’ve written a short NET2-MSVC-manual, here it is
(mailing due to request from Bob Pendleton, author
of NET2):

Create the .lib-file--------------------

  1. Create a new Win32 Static library project
    (File->New->Project->Win32 Static library)
  2. Click OK three times (make sure you don’t choose
    any of the MFC or precompiled header stuff)
  3. Add the following files to the project:
    net2.cpp
    SDLUtils.cpp
    fastevents.cpp
    trace.cpp
  4. Compile with F7
  5. Copy the *.h-files from the Net2 source
    to your compilers include directory (or add
    the net2-directory to your include directories
    with Tools->Options->Directories)
  6. If you want, copy the net2.lib-file to the
    lib-directory of MSVC

Use Net2 in a project

  1. Add the net2.lib-file created earlier to
    your project either via Project->Add To
    Project->Files or via Project->Settings->
    Link and adding ‘net2.lib’ to the list
    of Object/library modules. The latter
    assumes you’ve put net2.lib in the compilers
    lib-directory
  2. Add the following include’s:
    #include <net2.h>
    #include <fastevents.h>
    #include <SDLUtils.h>
    to your main file
  3. Make sure you Initialize this before using
    NET2, in that order:
    SDL
    SDL_Net
    Fastevents
    NET2
    ( see net2 doc )

Note on compiling server.cpp etc.

On the Win32 platform, INIT_EVENTTHREAD is
not supported. This results in server.cpp being
compilable but not runnable in Win32. The fix
is to remove the INIT_EVENTTHREAD in the SDL_Init()
call in server.cpp. The problem is that you
will lose some performance according to Bob
Pendleton (Net2) which I consulted on the matter.

Report any “bugs” to
/Olof Bjarnason

SkunkGuru: “[SDL] Re: window procedure” (2003-04-22 10:22)

#“Olof Bjarnason” ha scritto nel messaggio
#news:Pine.SOL.4.30.0304201222320.22148-100000 at grosse.mdstud.chalmers.se
#> SDL_Net doesn’t use the SDL-events; ie. you have
#> to treat network code different from mouse-events
#> or any other events. There is a library called
#> Net2 though, which builds ontop of SDL_Net, which
#> use the SDL-event paradigm. And it’s got great
#> documentation:
#> http://www.gameprogrammer.com/net2/net2-1.html
#>
#> In Net2 a network event such as “someone is trying
#> to connect” is received by a SDL_Event, so you can
#> put the network code directly beside the other
#> SDL-event code.

#Does Net2 work under Win32 ??
#I think it doesn’t work because under Win32 you can’t use eventthreads…

#–
#Bye

#_______________________________________________
#SDL mailing list
#SDL at libsdl.org
#http://www.libsdl.org/mailman/listinfo/sdl

“Olof Bjarnason” ha scritto nel messaggio
news:Pine.SOL.4.30.0304201222320.22148-100000 at grosse.mdstud.chalmers.se

SDL_Net doesn’t use the SDL-events; ie. you have
to treat network code different from mouse-events
or any other events. There is a library called
Net2 though, which builds ontop of SDL_Net, which
use the SDL-event paradigm. And it’s got great
documentation:
http://www.gameprogrammer.com/net2/net2-1.html

In Net2 a network event such as “someone is trying
to connect” is received by a SDL_Event, so you can
put the network code directly beside the other
SDL-event code.

Does Net2 work under Win32 ??
I think it doesn’t work because under Win32 you can’t use eventthreads…

Yes, NET2 works under Win32. You can’t use eventthreads, but that isn’t
a problem.

	Bob PendletonOn Tue, 2003-04-22 at 03:22, SkunkGuru wrote:


Bye


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

±----------------------------------+

  • Bob Pendleton: independent writer +
  • and programmer. +
  • email: Bob at Pendleton.com +
    ±----------------------------------+

Hum… I’ve downloaded the files of SDL_net 1.2 and I’ve put the SDL_net.h
and SDLnetsys.h into the directory Include (I’m Using devcpp) but there’s an
error:
[Linker error] undefined reference to `SDLNet_Init’
How can i fix this problem ?

Thanks a lot

Looks like you missed adding sdl_net.lib to your
linker, something like (not so sure check your
compiler manual on libraries…)

gcc … -lsdl_net …

/Olof

Lud2k: “[SDL] Re: window procedure” (2003-04-20 20:31)

#Hum… I’ve downloaded the files of SDL_net 1.2 and I’ve put the SDL_net.h
#and SDLnetsys.h into the directory Include (I’m Using devcpp) but there’s an
#error:
#[Linker error] undefined reference to `SDLNet_Init’
#How can i fix this problem ?#
#Thanks a lot

#_______________________________________________
#SDL mailing list
#SDL at libsdl.org
#http://www.libsdl.org/mailman/listinfo/sdl