File: FieldView2D.cpp

package info (click to toggle)
csmash 0.6.6-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 13,548 kB
  • ctags: 1,687
  • sloc: cpp: 19,531; sh: 3,515; makefile: 439; ansic: 120; sed: 16
file content (95 lines) | stat: -rw-r--r-- 2,366 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* $Id: FieldView2D.cpp,v 1.4 2001/09/19 14:05:22 nan Exp $ */

// Copyright (C) 2001  神南 吉宏(Kanna Yoshihiro)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#include "ttinc.h"
#include "FieldView2D.h"
#include "BaseView.h"
#include "BaseView2D.h"

extern bool
RenderRect( double x1, double y1, double z1, 
	    double x2, double y2, double z2, 
	    SDL_Rect *rect );

FieldView2D::FieldView2D() {
}

FieldView2D::~FieldView2D() {
}

bool
FieldView2D::Init() {
  m_floor = SDL_LoadBMP( "images/BG.bmp" );
  m_title = SDL_LoadBMP( "images/Title.bmp" );
  m_table = SDL_LoadBMP( "images/BGAlpha.bmp" );

  SDL_SetColorKey( m_title, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0 );
  SDL_SetAlpha( m_table, SDL_SRCALPHA|SDL_RLEACCEL, 100 );

  m_field = SDL_CreateRGBSurface( SDL_SWSURFACE, BaseView::GetWinWidth(),
					BaseView::GetWinHeight(),
					32, 0, 0, 0, 0 );

  SDL_Rect dest;

  dest.x = 0; 
  dest.y = 0; 
  dest.w = m_floor->w; 
  dest.h = m_floor->h; 
  SDL_BlitSurface(m_floor, NULL, m_field, &dest); 
 
  dest.x = 800-256; 
  dest.y = 600-256; 
  dest.w = m_title->w; 
  dest.h = m_title->h; 
  SDL_BlitSurface(m_title, NULL, m_field, &dest); 

  return true;
}

bool
FieldView2D::Redraw() {
  SDL_Rect dest;

  dest.x = 0;
  dest.y = 0;
  dest.w = m_field->w;
  dest.h = m_field->h;
  SDL_BlitSurface(m_field, NULL, BaseView::TheView()->GetSurface(), &dest);

  return true;
}

// Draw transparent object
bool
FieldView2D::RedrawAlpha() {
  SDL_Rect dest;

  dest.x = 0;
  dest.y = 0;
  dest.w = m_table->w;
  dest.h = m_table->h;
  SDL_BlitSurface(m_table, NULL, BaseView::TheView()->GetSurface(), &dest);

  return true;
}

bool
FieldView2D::GetDamageRect() {
  return true;
}