1 /* $Id: FieldView2D.cpp,v 1.4 2001/09/19 14:05:22 nan Exp $ */
2
3 // Copyright (C) 2001 $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 "FieldView2D.h"
21 #include "BaseView.h"
22 #include "BaseView2D.h"
23
24 extern bool
25 RenderRect( double x1, double y1, double z1,
26 double x2, double y2, double z2,
27 SDL_Rect *rect );
28
FieldView2D()29 FieldView2D::FieldView2D() {
30 }
31
~FieldView2D()32 FieldView2D::~FieldView2D() {
33 }
34
35 bool
Init()36 FieldView2D::Init() {
37 m_floor = SDL_LoadBMP( "images/BG.bmp" );
38 m_title = SDL_LoadBMP( "images/Title.bmp" );
39 m_table = SDL_LoadBMP( "images/BGAlpha.bmp" );
40
41 SDL_SetColorKey( m_title, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0 );
42 SDL_SetAlpha( m_table, SDL_SRCALPHA|SDL_RLEACCEL, 100 );
43
44 m_field = SDL_CreateRGBSurface( SDL_SWSURFACE, BaseView::GetWinWidth(),
45 BaseView::GetWinHeight(),
46 32, 0, 0, 0, 0 );
47
48 SDL_Rect dest;
49
50 dest.x = 0;
51 dest.y = 0;
52 dest.w = m_floor->w;
53 dest.h = m_floor->h;
54 SDL_BlitSurface(m_floor, NULL, m_field, &dest);
55
56 dest.x = 800-256;
57 dest.y = 600-256;
58 dest.w = m_title->w;
59 dest.h = m_title->h;
60 SDL_BlitSurface(m_title, NULL, m_field, &dest);
61
62 return true;
63 }
64
65 bool
Redraw()66 FieldView2D::Redraw() {
67 SDL_Rect dest;
68
69 dest.x = 0;
70 dest.y = 0;
71 dest.w = m_field->w;
72 dest.h = m_field->h;
73 SDL_BlitSurface(m_field, NULL, BaseView::TheView()->GetSurface(), &dest);
74
75 return true;
76 }
77
78 // Draw transparent object
79 bool
RedrawAlpha()80 FieldView2D::RedrawAlpha() {
81 SDL_Rect dest;
82
83 dest.x = 0;
84 dest.y = 0;
85 dest.w = m_table->w;
86 dest.h = m_table->h;
87 SDL_BlitSurface(m_table, NULL, BaseView::TheView()->GetSurface(), &dest);
88
89 return true;
90 }
91
92 bool
GetDamageRect()93 FieldView2D::GetDamageRect() {
94 return true;
95 }
96