Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

DemoNetworking.cpp

Go to the documentation of this file.
00001 /*
00002 CS Senior Project 2003
00003 Team : Leftfield
00004 Project : ModernWarfare
00005 Members :
00006 - Russ Christensen              <rchriste@cs.utah.edu>
00007 - Todd Smith                    <tcsmith@cs.utah.edu>
00008 - Usit Duongsaa                 <duongsaa@cs.utah.edu>
00009 Copyright 2003 Russ Christensen, Usit Duongsaa, and Todd Smith. All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00012 
00013 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
00014 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
00015 THIS SOFTWARE IS PROVIDED BY RUSS CHRISTENSEN, USIT DUONGSAA, AND TODD SMITH ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RUSS, USIT, TODD OR OTHER CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00016 */
00017 
00023 #include "WinMainSelector.h"
00024 #if defined COMPILE_DEMONETWORKING
00025 
00026 #include "Network.h"
00027 #include "..\AEngine\AEngine.h"
00028 
00029 namespace {
00030         int                     counter = 0;
00031         ATexture        pic             = 0;
00032         Network*    network = 0;
00033 
00034 //------------------------------------------------------------------------------------
00035 void init()
00036 {
00037         pic = load_texture("textures\\demos\\tank.tga");
00038         network = new Network();
00039         sys_showConsole(true);
00040 }
00041 //------------------------------------------------------------------------------------
00042 void update()
00043 {
00044         ++counter;
00045         network->listen(4040);
00046 }
00047 //------------------------------------------------------------------------------------
00048 void render()
00049 {
00050         if(counter%100==0) sys_console() << "Console Text : counter = " << counter << endl;
00051 
00052         overlay_rect( Vec2D(0.2f,0.2f), Vec2D(0.3f,0.2f) );
00053         overlay_text() << "Hello";
00054         overlay_textOut( Vec2D(0.5f, 0.7f) );
00055 
00056         overlay_image( pic, Vec2D(0.75f, 0.5f), Vec2D(0.1f,0.3f) );             
00057 
00058         // show mouse cursor when left mouse button is not held down
00059         if( !input_isMouseLBDown() )
00060         {
00061                 FLOAT x = input_getMouseX(),  y = input_getMouseY();
00062                 overlay_image( pic, Vec2D(x,y), Vec2D(0.1f,0.1f) );
00063                 overlay_text() << "Mouse Position is " << x << "  " << y;
00064                 overlay_textOut( Vec2D(0.5f, 0.8f) );
00065         }
00066 }
00067 } //end namespace
00068 //------------------------------------------------------------------------------------
00069 INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR, INT )
00070 {
00071         sys_init(hInst,800,600,32,false);
00072         sys_setInitFunc(init);
00073         sys_setUpdateFunc(update);
00074         sys_setRenderFunc(render);
00075         sys_go();
00076         return 0;
00077 }
00078 //------------------------------------------------------------------------------------
00079 #endif

Generated on Wed Apr 23 05:50:15 2003 for Modern Warfare by doxygen1.3-rc2