00001
00002
00003
00004
00005
00006
00007
00008 #include "window.h"
00009 #include "infowin.h"
00010 #include "checkbox.h"
00011 #include "scrnobj.h"
00012
00013
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
00034
00035
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
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