00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "ui.h"
00010 #include "button.h"
00011 #include <dos.h>
00012 #include <assert.h>
00013 #include <graphics.h>
00014
00015 const int Pause = 100;
00016
00017 void UserInterface::AboutButton(Display& IntroDisplay)
00018 {
00019 Window *wf1 = new Window (200, 80, GREEN, LIGHTGRAY);
00020 assert (wf1 != NULL);
00021 IntroDisplay.Add (wf1, 175, 20);
00022 IntroDisplay.Draw();
00023 wf1->Client().SetTextStyle (GOTHIC_FONT, 0, 3);
00024 wf1->Client().SetTextJustify (CENTER_TEXT, CENTER_TEXT);
00025 wf1->Client().OutTextXY (wf1->Client().GetMaxX()/2, wf1->Client().GetMaxY()/2, "PREGO");
00026 delay(Pause);
00027 Window *wf2 = new Window (200, 80, GREEN, LIGHTGRAY);
00028 assert (wf2 != NULL);
00029 IntroDisplay.Add (wf2, 5, 250);
00030 IntroDisplay.Draw();
00031 wf2->Client().SetTextStyle (GOTHIC_FONT, 0, 3);
00032 wf2->Client().SetTextJustify (CENTER_TEXT, CENTER_TEXT);
00033 wf2->Client().OutTextXY (wf2->Client().GetMaxX()/2, wf2->Client().GetMaxY()/2, "SOMBRERO");
00034 delay(Pause);
00035 Window *wf3 = new Window (200, 80, GREEN, LIGHTGRAY);
00036 assert (wf3 != NULL);
00037 IntroDisplay.Add (wf3, 350, 223);
00038 IntroDisplay.Draw();
00039 wf3->Client().SetTextStyle (GOTHIC_FONT, 0, 3);
00040 wf3->Client().SetTextJustify (CENTER_TEXT, CENTER_TEXT);
00041 wf3->Client().OutTextXY (wf3->Client().GetMaxX()/2, wf3->Client().GetMaxY()/2, "KNEE CAPS");
00042 delay (Pause);
00043 Window *wf4 = new Window (300, 50, BLUE, LIGHTGRAY);
00044 assert (wf4 != NULL);
00045 IntroDisplay.Add (wf4, 5, 400);
00046 IntroDisplay.Draw();
00047 wf4->Client().SetTextStyle (GOTHIC_FONT, 0, 2);
00048 wf4->Client().SetTextJustify (CENTER_TEXT, CENTER_TEXT);
00049 wf4->Client().OutTextXY (wf4->Client().GetMaxX()/2, wf4->Client().GetMaxY()/2, "Click anywhere to play game");
00050 delay (Pause/2);
00051 }
00052
00053
00054
00055 void UserInterface::Intro()
00056 {
00057 Display IntroDisplay;
00058
00059 IntroDisplay.SetBkColor (BLACK);
00060 IntroDisplay.Clear();
00061
00062 IntroDisplay.SetTextStyle (TRIPLEX_FONT, 0, 12);
00063 IntroDisplay.SetColor (LIGHTGRAY);
00064 IntroDisplay.SetTextJustify (CENTER_TEXT, CENTER_TEXT);
00065 IntroDisplay.OutTextXY (IntroDisplay.GetMaxX()/2, 90, "Scotland");
00066 IntroDisplay.SetColor (WHITE);
00067 IntroDisplay.OutTextXY (IntroDisplay.GetMaxX()/2 - 4, 86, "Scotland");
00068 IntroDisplay.SetTextStyle (TRIPLEX_FONT, 0, 14);
00069 IntroDisplay.SetColor (LIGHTGRAY);
00070 IntroDisplay.OutTextXY (IntroDisplay.GetMaxX()/2, 300, "Yard");
00071 IntroDisplay.SetColor (WHITE);
00072 IntroDisplay.OutTextXY (IntroDisplay.GetMaxX()/2 - 4, 296, "Yard");
00073
00074
00075
00076 Window *w2 = new Window (100, 80, BLUE, LIGHTGRAY);
00077 assert (w2 != NULL);
00078 IntroDisplay.Add (w2, 160, 180);
00079 IntroDisplay.Draw();
00080 w2->Client().SetTextStyle (GOTHIC_FONT, 0, 3);
00081 w2->Client().SetColor (BLUE);
00082 w2->Client().OutTextXY(18, 10, "Chris");
00083 w2->Client().OutTextXY(15, 30, "L");
00084 delay(Pause);
00085
00086 Window *w4 = new Window (100, 80, BLUE, LIGHTGRAY);
00087 assert (w4 != NULL);
00088 IntroDisplay.Add (w4, 370, 180);
00089 IntroDisplay.Draw();
00090 w4->Client().SetTextStyle (GOTHIC_FONT, 0, 3);
00091 w4->Client().SetColor (BLUE);
00092 w4->Client().OutTextXY(20, 10, "Evan");
00093 w4->Client().OutTextXY(14, 30, "O");
00094 delay(Pause);
00095
00096 Window *w3 = new Window (100, 80, BLUE, LIGHTGRAY);
00097 assert (w3 != NULL);
00098 IntroDisplay.Add (w3, 265, 180);
00099 IntroDisplay.Draw();
00100 w3->Client().SetTextStyle (GOTHIC_FONT, 0, 3);
00101 w3->Client().SetColor (BLUE);
00102 w3->Client().OutTextXY(15, 10, "Wilson");
00103 w3->Client().OutTextXY(20, 30, "T");
00104 delay(Pause);
00105
00106 Window *w = new Window (100, 80, BLUE, LIGHTGRAY);
00107 assert (w != NULL);
00108 IntroDisplay.Add (w, 55, 180);
00109 IntroDisplay.Draw();
00110 w->Client().SetTextStyle (GOTHIC_FONT, 0, 3);
00111 w->Client().SetColor (BLUE);
00112 w->Client().OutTextXY(18, 10, "Steve");
00113 w->Client().OutTextXY(18, 30, "W");
00114 delay(Pause);
00115
00116 Window *w5 = new Window (100, 80, BLUE, LIGHTGRAY);
00117 assert (w5 != NULL);
00118 IntroDisplay.Add (w5, 475, 180);
00119 IntroDisplay.Draw();
00120 w5->Client().SetTextStyle (GOTHIC_FONT, 0, 3);
00121 w5->Client().SetColor (BLUE);
00122 w5->Client().OutTextXY(20, 10, "Evan");
00123 w5->Client().OutTextXY(14, 30, "B");
00124
00125 PushButton *pb = new PushButton ("Play Game", BLUE, 0xFB);
00126 assert (pb != NULL);
00127 PushButton *pb2 = new PushButton ("About...", BLUE, 0xFA);
00128 assert (pb2 != NULL);
00129
00130
00131
00132 IntroDisplay.Add (pb, 500, IntroDisplay.GetMaxY() - pb->GetYDim() - 5);
00133 IntroDisplay.Add (pb2, 500 - pb->GetXDim() - 5, IntroDisplay.GetMaxY() - pb2->GetYDim() - 5);
00134
00135 IntroDisplay.Draw();
00136
00137 Message DoneMsg (ButtonMsg, ButtonPress, 0xFB),
00138 AboutMsg (ButtonMsg, ButtonPress, 0xFA),
00139
00140 m;
00141
00142 do {
00143 m = IntroDisplay.Dispatch (Mouse.Event());
00144 if (m == AboutMsg)
00145 { AboutButton(IntroDisplay);
00146 m = IntroDisplay.Dispatch (Mouse.WaitForAnyEvent());
00147 m = DoneMsg;
00148 }
00149
00150
00151
00152
00153
00154
00155
00156
00157 } while (m != DoneMsg);
00158 }