Google
Web alhem.net
Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

InitSDL.cpp

Go to the documentation of this file.
00001 00006 /* 00007 Copyright (C) 2004 Anders Hedstrom 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License 00011 as published by the Free Software Foundation; either version 2 00012 of the License, or (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 */ 00023 #include <stdincl.h> 00024 00025 #include "client.h" 00026 #include "InitSDL.h" 00027 00028 00029 InitSDL::InitSDL(int argc,char *argv[]) : gui::SDLControl(argc,argv) 00030 { 00031 } 00032 00033 00034 InitSDL::~InitSDL() 00035 { 00036 } 00037 00038 00039 /* Draw a randomly sized and colored box centered about (X,Y) */ 00040 void InitSDL::DrawBox(int X, int Y) 00041 { 00042 static unsigned int seeded = 0; 00043 SDL_Rect area; 00044 Uint32 color; 00045 00046 /* Seed the random number generator */ 00047 if ( seeded == 0 ) 00048 { 00049 srand(time(NULL)); 00050 seeded = 1; 00051 } 00052 00053 /* Get the bounds of the rectangle */ 00054 area.w = (rand() % XMAX); 00055 area.h = (rand() % YMAX); 00056 area.x = X - (area.w / 2); 00057 area.y = Y - (area.h / 2); 00058 color = (rand() % NUM_COLORS); 00059 color = 0; 00060 00061 /* Do it! */ 00062 LockMutex(); 00063 SDL_FillRect(GetScreen(), &area, color); 00064 SDL_UpdateRects(GetScreen(), 1, &area); 00065 UnlockMutex(); 00066 } 00067 00068 00069 /* 00070 void InitSDL::Init_SDL() 00071 { 00072 DEB(printf("SDL_Init()\n");) 00073 if (SDL_Init( SDL_INIT_TIMER|SDL_INIT_VIDEO ) < 0) 00074 { 00075 DEB(printf("SDL_Init() ej ok\n");) 00076 fprintf(stderr,"SDL error: %s\n",SDL_GetError() ); 00077 } 00078 else 00079 { 00080 DEB(printf("SDL_Init() OK\n");) 00081 // m_ok = true; 00082 SetOK(true); 00083 } 00084 } 00085 */ 00086 00087

Generated for SDL C++ GUI by doxygen 1.3.6