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 - xzhang63@gmail.com

Pages: [1]
1
Network / UDP and TCP together
« on: February 10, 2012, 01:09:56 pm »
In my game, there are numerous motion  actions, which should be communicated with UDP
however, there are also important events that has to be communicated with TCP
Appreciate a sample program that provide both UDP and TCP to multiple client.

Thanks!

2
Graphics / rotating background scrolling
« on: February 03, 2012, 06:43:40 pm »
my 1st person view ( avata always at center)
allow avata to chenge angle, therefore the background image can rotate and scroll.

 my total image is twice as large as the monitor composed with tiles with 200 size

Code: [Select]
void CApp::OnLoop() {
   float ElapsedTime = GetFrameTime();
bool k=false;
        if (GetInput().IsKeyDown(sf::Key::Left))  { k=true; Background.Rotate(100 * ElapsedTime);}
        if (GetInput().IsKeyDown(sf::Key::Right)) { k=true; Background.Rotate( -100 * ElapsedTime);}
        if (GetInput().IsKeyDown(sf::Key::Up))    { k=true; Background.Move(0, 100 * ElapsedTime);}
        if (GetInput().IsKeyDown(sf::Key::Down))  { k=true; Background.Move(0, -100 * ElapsedTime);}
        float x = Background.GetPosition().x;
        float y = Background.GetPosition().y;
        float r = Background.GetRotation();
        x=W/2+ fmod(x-W/2,200/fabs(sin(r*M_PI/180)));
        y=H/2+ fmod(y-H/2,200/fabs(cos(r*M_PI/180)));
        Background.SetPosition(x,y);
}


however, when there is an angle, the image is jumpy
when no angle, the program works.
Please help!
Appreciated.

Pages: [1]