Main Page   Packages   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

LoginDialog.cpp

Go to the documentation of this file.
00001 /*
00002  * $Id: LoginDialog.cpp,v 1.7 2002/08/09 04:52:08 virtualcasino Exp $
00003  */
00004 #include<LoginDialog.h>
00005 #include<Resource.h>
00006 #include<Font.h>
00007 #include<fx.h>
00008 #include<SDL.h>
00009 
00010 extern SDL_Event globalEvent;
00011 namespace clawsoft{
00012 
00013 LoginDialog::LoginDialog(){
00014         setClassName("LoginDialog");
00015         X(332);
00016         Y(234);
00017         W(380);
00018         H(200);
00019         caption = "Virtual Casino";
00020         nombre = 0;
00021                 /*okBtn->me = this;
00022                 cancelBtn->me = this;
00023                 helpBtn->me = this;*/
00024 }
00025 
00026 void LoginDialog::drawContents(){
00027         SDL_Surface *label;
00028         SDL_Rect dst, src;
00029         label = SystemFont[DEFAULT_FONT].render("Nombre de usuario:");
00030         dst.x = X() + 20;
00031         dst.y = Y() + 40;
00032         src.x = 0;
00033         src.y = 0;
00034         src.w = label->w;
00035         src.h = label->h;
00036         SDL_BlitSurface(label, &src, Screen, &dst);
00037         nombre->draw();
00038         SDL_FreeSurface(label);
00039 }
00040 
00041 void LoginDialog::okAction(int xx, int yy, int bb){
00042         state = true;
00043         doexit = true;
00044 }
00045 
00046 void LoginDialog::cancelAction(int xx, int yy, int bb){
00047         state = false;
00048         doexit = true;
00049 }
00050 
00051 void LoginDialog::map(){
00052         Dialog::map();
00053         if(!nombre){
00054                 Rect a(X() + 200, Y() + 100, 200, 200);
00055                 nombre = new TextField(a);
00056         }
00057         nombre->X(X() + 170);
00058         nombre->Y(Y() + 100);
00059 }
00060 
00061 bool LoginDialog::run(){
00062         bool flag;
00063         doexit = false;
00064         SDL_BlitSurface(bRes[BACKGROUND], 0, Screen, 0);
00065         while(!doexit){
00066                 flag = false;
00067                 while(SDL_PollEvent(&globalEvent)){
00068                         switch(globalEvent.type){
00069                                 case SDL_MOUSEMOTION:
00070                                         if(checkMouseMotionEvents())
00071                                                 SDL_BlitSurface(bRes[BACKGROUND], 0, Screen, 0);
00072                                         nombre->checkMouseMotionEvents();
00073                                         break;
00074                                 case SDL_MOUSEBUTTONDOWN:
00075                                         checkMouseEvents();
00076                                         nombre->checkMouseEvents();
00077                                         break;
00078                                 case SDL_KEYDOWN:
00079                                         nombre->checkKeyEvents();
00080                                         break;
00081                         }
00082                         flag = true;
00083                 }
00084                 if(flag){
00085                 //      SDL_FillRect(Screen, 0, 0);
00086                         draw();
00087                         //drawGrid();
00088                         SDL_Flip(Screen);
00089                 }
00090         }
00091         return state;
00092 }
00093 
00094 String &LoginDialog::getText(){
00095         return nombre->getText();
00096 }
00097 }

Powered by:

SourceForge Logo