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

infowin.c

Go to the documentation of this file.
00001 // ******************************************************************
00002 // * TITLE: infowin.c                                               *
00003 // * AUTHOR: Steven W                                           *
00004 // * DATE: May 1, 1993                                              *
00005 // * Purpose: Create display info Window for main screen            *
00006 // ******************************************************************
00007 
00008 #include "window.h"
00009 #include "infowin.h"
00010 #include "checkbox.h"
00011 #include "scrnobj.h"
00012 
00013   // temporary??
00014 #include "players.h"
00015 #include "ufwoom.h"
00016 
00017 #include <alloc.h>
00018 #include <assert.h>
00019 #include <stdlib.h>
00020 #include <stdio.h>
00021 #include <conio.h>
00022 #include <string.h>
00023 
00024 InfoWindow::InfoWindow ()
00025 {
00026   XDim = InfoXDim;  YDim = InfoYDim;
00027   CliX1 = CliY1 = CliX2 = CliY2 = 0;
00028   TX1 = TY1 = TX2 = TY2 = 0;
00029   BorderColor = RED;
00030   BkColor = LIGHTGRAY;
00031   TitleColor = WHITE;
00032   Title = NULL;
00033 //  Title = new char [15];
00034 //  assert (Title != 0);
00035 //  strcpy (Title, "Mark's Mind");
00036   ClientD = TitleD = NULL;
00037   Drawn = False;
00038 }
00039 
00040 void InfoWindow::Init (Display *d, int x, int y)
00041 {
00042   Disp = d;
00043   X = x;  Y = y;
00044 
00045   CalcBorder ();
00046   if (Title)
00047   {
00048     CalcTitle ();
00049     TitleD = new Display (Disp, TX1, TY1, TX2, TY2);
00050     assert (TitleD != 0);
00051     TitleD->SetBkColor (BorderColor);
00052     TitleD->SetTextJustify (CENTER_TEXT, TOP_TEXT);
00053     TitleD->SetTextStyle (TitleFont, HORIZ_DIR, TitleFontSize);
00054     TitleD->SetColor (TitleColor);
00055   }
00056   ClientD = new Display (Disp, CliX1, CliY1, CliX2, CliY2);
00057   assert (ClientD != 0);
00058   ClientD->SetBkColor (BkColor);
00059 }
00060 
00061 
00062 void InfoWindow::Draw (void)
00063 {
00064   char buf[40];
00065 
00066   if (!Drawn)
00067   {
00068     assert (Disp != NULL);
00069     Disp->FastDraw ();
00070     PrepScreen ();
00071     DrawBorder ();
00072     if (TitleD)
00073       DrawTitle ();
00074     ClientD->Clear ();
00075     ClientD->Draw ();
00076     Disp->Done ();
00077     Drawn = True;
00078 
00079     // Add text to window
00080     ClientD->SetColor(BLACK);
00081     ClientD->SetTextStyle(GOTHIC_FONT, HORIZ_DIR, 1);
00082     strcpy(buf, "Scotland Yard");
00083   ClientD->OutTextXY(ClientD->GetMaxX()/2-ClientD->TextWidth(buf)/2,10, buf);
00084     ClientD->SetColor(RED);
00085     strcpy(buf, "London, 1869");
00086   ClientD->OutTextXY(ClientD->GetMaxX()/2-ClientD->TextWidth(buf)/2+4,33, buf);
00087 
00088   }
00089 }
00090 

Generated on Sun Jul 6 23:07:15 2003 for Scotland Yard by doxygen1.2.15