1 /* $Id: View.cpp,v 1.4 2002/09/07 04:41:32 nan Exp $ */
2 
3 // Copyright (C) 2000, 2002  $B?@Fn(B $B5H9((B(Kanna Yoshihiro)
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 
19 #include "ttinc.h"
20 #include "View.h"
21 #include "RCFile.h"
22 #include "PlayerView.h"
23 #include "PlayerView2D.h"
24 #include "BallView.h"
25 #include "BallView2D.h"
26 #include "FieldView.h"
27 #include "FieldView2D.h"
28 #include "HowtoView.h"
29 //#include "HowtoView2D.h"
30 #include "MenuItemView.h"
31 #include "MenuItemView2D.h"
32 #include "OpeningView.h"
33 //#include "OpeningView2D.h"
34 #include "PlayGameView.h"
35 //#include "PlayGameView2D.h"
36 #include "PlayerSelectView.h"
37 #include "PlayerSelectView2D.h"
38 #include "PracticeSelectView.h"
39 //#include "PracticeSelectView2D.h"
40 #include "TrainingSelectView.h"
41 //#include "TrainingSelectView2D.h"
42 #include "TitleView.h"
43 #include "TitleView2D.h"
44 #include "TrainingView.h"
45 //#include "TrainingView2D.h"
46 
47 extern RCFile *theRC;
48 
View()49 View::View() {
50   m_next = (View *)0;
51 }
52 
~View()53 View::~View() {
54 }
55 
56 bool
RedrawAlpha()57 View::RedrawAlpha() {
58   return true;
59 }
60 
61 bool
GetDamageRect()62 View::GetDamageRect(){
63   return true;
64 }
65 
66 View*
CreateView(int viewType)67 View::CreateView( int viewType ) {
68   if ( theRC->gmode == GMODE_2D ) {
69     return CreateView2D( viewType );
70   } else {
71     return CreateView3D( viewType );
72   }
73 }
74 
75 View*
CreateView2D(int viewType)76 View::CreateView2D( int viewType ) {
77   switch ( viewType ) {
78   case VIEW_PLAYER:
79     return new PlayerView2D();
80   case VIEW_BALL:
81     return new BallView2D();
82   case VIEW_FIELD:
83     return new FieldView2D();
84   case VIEW_HOWTO:
85     //return new HowtoView2D();
86     return NULL;
87   case VIEW_MENUITEM:
88     return new MenuItemView2D();
89   case VIEW_OPENING:
90     //return new OpeningView2D();
91     return NULL;
92   case VIEW_PLAYGAME:
93     //return new PlayGameView2D();
94     return NULL;
95   case VIEW_PLAYERSELECT:
96     return new PlayerSelectView2D();
97   case VIEW_PRACTICESELECT:
98     //return new PracticeSelectView2D();
99     return NULL;
100   case VIEW_TRAININGSELECT:
101     //return new TrainingSelectView2D();
102     return NULL;
103   case VIEW_TITLE:
104     return new TitleView2D();
105   case VIEW_TRAINING:
106     //return new TrainingView2D();
107     return NULL;
108   default:
109     return NULL;
110   }
111 }
112 
113 View*
CreateView3D(int viewType)114 View::CreateView3D( int viewType ) {
115   switch ( viewType ) {
116   case VIEW_PLAYER:
117     return new PlayerView();
118   case VIEW_BALL:
119     return new BallView();
120   case VIEW_FIELD:
121     return new FieldView();
122   case VIEW_HOWTO:
123     return new HowtoView();
124   case VIEW_MENUITEM:
125     return new MenuItemView();
126   case VIEW_OPENING:
127     return new OpeningView();
128   case VIEW_PLAYGAME:
129     return new PlayGameView();
130   case VIEW_PLAYERSELECT:
131     return new PlayerSelectView();
132   case VIEW_PRACTICESELECT:
133     return new PracticeSelectView();
134   case VIEW_TRAININGSELECT:
135     return new TrainingSelectView();
136   case VIEW_TITLE:
137     return new TitleView();
138   case VIEW_TRAINING:
139     return new TrainingView();
140   default:
141     return NULL;
142   }
143 }
144