Worked out the basic server layout
This commit is contained in:
+21
-3
@@ -4,11 +4,12 @@
|
||||
#include "SDL_net/SDL_net.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
Server::Server() {
|
||||
//
|
||||
running = true;
|
||||
}
|
||||
|
||||
Server::~Server() {
|
||||
@@ -19,15 +20,32 @@ void Server::Init() {
|
||||
if (SDLNet_Init()) {
|
||||
throw(runtime_error("Failed to init SDL_net"));
|
||||
}
|
||||
netMgr.Init(100);
|
||||
}
|
||||
|
||||
void Server::Proc() {
|
||||
bool running = true;
|
||||
while(running) {
|
||||
//
|
||||
HandleInput();
|
||||
UpdateWorld();
|
||||
HandleOutput();
|
||||
}
|
||||
}
|
||||
|
||||
void Server::Quit() {
|
||||
netMgr.Quit();
|
||||
SDLNet_Quit();
|
||||
}
|
||||
|
||||
void Server::HandleInput() {
|
||||
//accept new connections
|
||||
//accept updates from the clients
|
||||
}
|
||||
|
||||
void Server::UpdateWorld() {
|
||||
//update internals
|
||||
}
|
||||
|
||||
void Server::HandleOutput() {
|
||||
//send all information to new connections
|
||||
//selective updates to existing connectons
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user