zenilib
0.5.3.0
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL_net.h"
#include <GUI/GUI.h>
#include <GUI/GUI_widgets.h>
#include "chat.h"
Go to the source code of this file.
Enumerations | |
enum | image_names { IMAGE_QUIT, IMAGE_SCROLL_UP, IMAGE_SCROLL_DN, NUM_IMAGES } |
Functions | |
void | cleanup (int exitcode) |
void | HandleClient (void) |
GUI_status | HandleNet (void) |
void | HandleServer (void) |
int | HandleServerData (Uint8 *data) |
void | InitGUI (SDL_Surface *screen) |
int | main (int argc, char *argv[]) |
void | SendBuf (char *buf, int len) |
void | SendHello (char *name) |
void | SendKey (SDLKey key, Uint16 unicode) |
Variables | |
static GUI * | gui = NULL |
char * | image_files [NUM_IMAGES] |
SDL_Surface * | images [NUM_IMAGES] |
static UDPpacket ** | packets = NULL |
struct { | |
int active | |
Uint8 name [256+1] | |
} | people [CHAT_MAXPEOPLE] |
static GUI_TermWin * | sendwin |
static SDLNet_SocketSet | socketset = NULL |
static TCPsocket | tcpsock = NULL |
static GUI_TermWin * | termwin |
static UDPsocket | udpsock = NULL |
enum image_names |
Definition at line 339 of file chat.cpp.
References gui, i, NULL, NUM_IMAGES, SDL_FreeSurface(), SDL_Quit(), SDLNet_FreePacketV(), SDLNet_FreeSocketSet(), SDLNet_Quit(), SDLNet_TCP_Close(), SDLNet_UDP_Close(), socketset, tcpsock, and udpsock.
Referenced by main().
Definition at line 270 of file chat.cpp.
References people, SDLNet_UDP_RecvV(), termwin, and udpsock.
Referenced by HandleNet(), and main().
GUI_status HandleNet | ( | void | ) |
Definition at line 284 of file chat.cpp.
References HandleClient(), HandleServer(), SDLNet_CheckSockets(), SDLNet_SocketReady, socketset, tcpsock, termwin, and udpsock.
Referenced by main().
Definition at line 242 of file chat.cpp.
References HandleServerData(), NULL, SDLNet_TCP_Close(), SDLNet_TCP_DelSocket(), SDLNet_TCP_Recv(), socketset, tcpsock, and termwin.
Referenced by HandleNet(), and main().
Definition at line 167 of file chat.cpp.
References active, CHAT_ADD, CHAT_ADD_HOST, CHAT_ADD_NAME, CHAT_ADD_NLEN, CHAT_ADD_PORT, CHAT_ADD_SLOT, CHAT_BYE, CHAT_BYE_LEN, CHAT_DEL, CHAT_DEL_LEN, CHAT_DEL_SLOT, CHAT_MAXPEOPLE, IPaddress::host, memcpy, people, IPaddress::port, SDL_SwapBE16, SDL_SwapBE32, SDLNet_Read16, SDLNet_Read32, SDLNet_UDP_Bind(), SDLNet_UDP_Unbind(), termwin, and udpsock.
Referenced by HandleServer().
void InitGUI | ( | SDL_Surface * | screen | ) |
Definition at line 302 of file chat.cpp.
References CHAT_PROMPT, CHAT_SCROLLBACK, gui, SDL_Surface::h, IMAGE_QUIT, IMAGE_SCROLL_DN, IMAGE_SCROLL_UP, NULL, SendKey(), sendwin, termwin, and SDL_Surface::w.
Referenced by main().
Definition at line 377 of file chat.cpp.
References CHAT_PACKETSIZE, CHAT_PORT, cleanup(), gui, HandleNet(), IPaddress::host, i, image_files, INADDR_NONE, InitGUI(), NULL, NUM_IMAGES, SDL_GetError(), SDL_Init(), SDL_INIT_VIDEO, SDL_LoadBMP, SDL_Quit(), SDL_SWSURFACE, SDLNet_AllocPacketV(), SDLNet_AllocSocketSet(), SDLNet_GetError(), SDLNet_Init(), SDLNet_ResolveHost(), SDLNet_TCP_AddSocket(), SDLNet_TCP_Close(), SDLNet_TCP_Open(), SDLNet_UDP_AddSocket(), SDLNet_UDP_Open(), SendHello(), socketset, tcpsock, termwin, and udpsock.
Definition at line 104 of file chat.cpp.
References active, CHAT_MAXPEOPLE, CHAT_PROMPT, i, UDPpacket::len, UDPpacket::maxlen, memcpy, people, SDLNet_UDP_Send(), sendwin, and udpsock.
Referenced by SendKey().
void SendHello | ( | char * | name | ) |
Definition at line 67 of file chat.cpp.
References CHAT_HELLO, CHAT_HELLO_NAME, CHAT_HELLO_NLEN, CHAT_HELLO_PORT, CHAT_MAXPEOPLE, hello, i, memcpy, NULL, people, IPaddress::port, SDLNet_TCP_Send(), SDLNet_UDP_GetPeerAddress(), tcpsock, termwin, and udpsock.
Referenced by main().
|
static |
char* image_files[NUM_IMAGES] |
SDL_Surface* images[NUM_IMAGES] |
Definition at line 46 of file chat.cpp.
Referenced by SDLNet_UDP_Recv().
struct { ... } people[CHAT_MAXPEOPLE] |
Referenced by HandleClient(), HandleServerData(), SendBuf(), and SendHello().
|
static |
|
static |
Definition at line 45 of file chat.cpp.
Referenced by cleanup(), HandleNet(), HandleServer(), and main().
Definition at line 43 of file chat.cpp.
Referenced by cleanup(), HandleNet(), HandleServer(), main(), and SendHello().
|
static |
Definition at line 53 of file chat.cpp.
Referenced by HandleClient(), HandleNet(), HandleServer(), HandleServerData(), InitGUI(), main(), and SendHello().
Definition at line 44 of file chat.cpp.
Referenced by cleanup(), HandleClient(), HandleNet(), HandleServerData(), main(), SendBuf(), and SendHello().