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

PlayerWindow Class Reference

#include <playrwin.h>

Inheritance diagram for PlayerWindow:

Window ScrnObj List of all members.

Public Methods

 PlayerWindow (void)
void Draw (void)
Message Dispatch (Message &)
void Update (Player &, int)
void Clear ()

Private Methods

void DrawInfo (void)

Private Attributes

char * Name
int Tokens [NTokenTypes]
int RoundNum
int Address

Constructor & Destructor Documentation

PlayerWindow::PlayerWindow void   
 

Definition at line 16 of file playrwin.c.

References Address, Window::BkColor, Window::BorderColor, Bus, Window::ClientD, Window::CliX1, Window::CliX2, Window::CliY1, Window::CliY2, ScrnObj::Drawn, False, Name, PlayerWinTitle, PlayerWinXDim, PlayerWinYDim, RoundNum, Subway, Taxi, Window::Title, Window::TitleColor, Window::TitleD, Tokens, Window::TX1, Window::TX2, Window::TY1, Window::TY2, Window::XDim, and Window::YDim.

00017 {
00018   XDim = PlayerWinXDim;  YDim = PlayerWinYDim;
00019   CliX1 = CliY1 = CliX2 = CliY2 = 0;
00020   TX1 = TY1 = TX2 = TY2 = 0;
00021   BorderColor = RED;
00022   BkColor = LIGHTGRAY;
00023   TitleColor = WHITE;
00024   Title = new char [strlen (PlayerWinTitle)];
00025   assert (Title != 0);
00026   strcpy (Title, PlayerWinTitle);
00027   ClientD = TitleD = NULL;
00028   Drawn = False;
00029   Name = "Welcome to Scotland Yard";
00030   Tokens[Bus] = 0;
00031   Tokens[Taxi] = 0;
00032   Tokens[Subway] = 0;
00033   RoundNum = 0;
00034   Address = 0;
00035 }


Member Function Documentation

void PlayerWindow::Clear   [inline]
 

Definition at line 34 of file playrwin.h.

References Viewport::Clear(), Window::Client(), and Display::Erase().

Referenced by Update().

00034 { Client().Erase(); Client().Clear(); }

Message PlayerWindow::Dispatch Message   [inline, virtual]
 

Reimplemented from Window.

Definition at line 30 of file playrwin.h.

00030 { return NullMsg; }

void PlayerWindow::Draw void    [virtual]
 

Reimplemented from Window.

Definition at line 77 of file playrwin.c.

References Viewport::Clear(), Window::ClientD, ScrnObj::Disp, Viewport::Done(), Display::Draw(), Window::DrawBorder(), DrawInfo(), ScrnObj::Drawn, Window::DrawTitle(), Viewport::FastDraw(), Window::PrepScreen(), and True.

00078 {
00079   if (!Drawn)
00080   {
00081     assert (Disp != NULL);
00082     Disp->FastDraw ();
00083     PrepScreen ();
00084     DrawBorder ();
00085     if (TitleD)
00086       DrawTitle ();
00087     ClientD->Clear ();
00088     ClientD->Draw ();
00089     DrawInfo ();
00090     Disp->Done ();
00091     Drawn = True;
00092   }
00093 }

void PlayerWindow::DrawInfo void    [private]
 

Definition at line 38 of file playrwin.c.

References Address, Bus, Window::ClientD, Invalid, Name, Viewport::OutTextXY(), RoundNum, Viewport::SetColor(), Viewport::SetTextJustify(), Viewport::SetTextStyle(), Subway, Taxi, and Tokens.

Referenced by Draw(), and Update().

00039 {
00040   char AddressBuf[21], buffer[80];
00041   char bus[20], taxi[20], subway[20], round[20];
00042 
00043   ClientD->SetColor (BLACK);
00044   ClientD->SetTextStyle (GOTHIC_FONT, HORIZ_DIR, 1);
00045   ClientD->SetTextJustify (LEFT_TEXT, TOP_TEXT);
00046   ClientD->OutTextXY (5, 5, Name);
00047   ClientD->SetTextStyle (DEFAULT_FONT, HORIZ_DIR, 1);
00048 
00049   if ((strcmp (Name, "Welcome to Scotland Yard")) == 0)
00050     {ClientD->OutTextXY (5, 40, "Written by THE MAD HAMSTERS");}
00051   else
00052   if (Tokens[Bus]!=Invalid) {
00053     sprintf (bus, "Bus %d", Tokens[Bus]);
00054     ClientD->OutTextXY (5, 40, bus);
00055     sprintf (taxi, "Taxi %d", Tokens[Taxi]);
00056     ClientD->OutTextXY (65, 40, taxi);
00057     sprintf (subway, "Subway %d", Tokens[Subway]);
00058     ClientD->OutTextXY (133, 40, subway);
00059     sprintf (round, "Round: %d", RoundNum+1);
00060     ClientD->OutTextXY (133, 5, round);
00061 
00062     if(theMap.get_name(Address)) {
00063       sprintf(buffer, "%-20s", theMap.get_name(Address));
00064       ClientD->OutTextXY (5, 30, buffer);
00065     }
00066   }
00067   else
00068   {
00069     ClientD->OutTextXY (5,40, "says, 'Bloody Wanker'!!");
00070     sprintf (round, "Round: %d", RoundNum+1);
00071     ClientD->OutTextXY (133, 5, round);
00072   }
00073 
00074 }

void PlayerWindow::Update Player  ,
int   
 

Definition at line 96 of file playrwin.c.

References Address, Bus, Clear(), DrawInfo(), Player::GetName(), Player::GetPosition(), Name, Player::NumTokens(), RoundNum, Subway, Taxi, and Tokens.

Referenced by UserInterface::BeginTurn().

00097 {
00098   Name = P.GetName ();
00099   Address = P.GetPosition();
00100   Tokens [Taxi] = P.NumTokens (Taxi);
00101   Tokens [Bus] = P.NumTokens (Bus);
00102   Tokens [Subway] = P.NumTokens (Subway);
00103   RoundNum=roundnum;
00104   Clear();
00105   DrawInfo();
00106 }


Member Data Documentation

int PlayerWindow::Address [private]
 

Definition at line 23 of file playrwin.h.

Referenced by DrawInfo(), PlayerWindow(), and Update().

char* PlayerWindow::Name [private]
 

Definition at line 22 of file playrwin.h.

Referenced by DrawInfo(), PlayerWindow(), and Update().

int PlayerWindow::RoundNum [private]
 

Definition at line 23 of file playrwin.h.

Referenced by DrawInfo(), PlayerWindow(), and Update().

int PlayerWindow::Tokens[NTokenTypes] [private]
 

Definition at line 23 of file playrwin.h.

Referenced by DrawInfo(), PlayerWindow(), and Update().


The documentation for this class was generated from the following files:
Generated on Sun Jul 6 23:07:17 2003 for Scotland Yard by doxygen1.2.15