No errors when compiling and I can comment out most of the main function and it still frezzes.
Remove the SDL parts and it won't freeze up but then again the SDL is most of the program.
CODE:
//Main.cpp
#include <SDL.h>
#include <iostream>
#include "Socket.h"
#include <fstream>
#include <string>
using namespace std;
SDL_Surface *screen;
SDL_Event event;
void apply_surface( int x, int y, SDL_Surface* source)
{
//Make a temporary rectangle to hold the offsets
SDL_Rect offset;
//Give the offsets to the rectangle
offset.x = x;
offset.y = y;
//Blit the surface
SDL_BlitSurface( source, NULL, screen, &offset );
SDL_Flip(screen);
}
void clearscreen(){
SDL_FillRect( screen, &screen->clip_rect, SDL_MapRGB( screen->format, 0x00, 0x00, 0x00 ) );
}
class Dot
{
private:
//The X and Y offsets of the dot
int x, y;
public:
//Initializes the variables
Dot();
//Takes key presses and adjusts the dot's velocity
void handle_input(int xz, int yz);
//Moves the dot
void move();
//Shows the dot on the screen
void show();
int getx();
int gety();
};
Dot::Dot()
{
//Initialize the offsets
x = 0;
y = 0;
}
void Dot::handle_input(int xz,int yz)
{
x = xz;
y = yz;
}
void Dot::show()
{
SDL_Rect basd;
basd.w = 10;
basd.h = 10;
basd.y = y;
basd.x = x;
SDL_FillRect( screen, &basd, SDL_MapRGB( screen->format, 0x00, 0x99, 0x00 ) );
}
int Dot::getx(){
return x;
}
int Dot::gety(){
return y;
}
int main(int argc, char* args[])
{
screen = SDL_SetVideoMode(500,500,32,0);
//Dot ase;
int choice;
int port = 4521;
//char *ipAddress = "127.0.0.1";
string ipAddress;
bool done = false;
char recMessage[STRLEN];
char sendMessage[STRLEN];
//Client
ClientSocket sockClient;
sockClient.ConnectToServer("127.0.0.1", 4753 );
//Connected
//74.76.149.190
string jppa;
int pos1,pos2;
while ( true )
{
sockClient.RecvData(recMessage,STRLEN);
string sad = recMessage;
if(strlen(sad.c_str()) > 6){
int pos = sad.find("BA");
string xc,yc;
xc = sad.substr(0,3);
yc = sad.substr(pos+3);
int ll,kk;
ll = atoi(xc.c_str());
kk = atoi(yc.c_str());
}
SDL_Delay(150);
}
}