File: PlayGameView.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 (87 lines) | stat: -rw-r--r-- 2,159 bytes parent folder | download | duplicates (6)
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
/* $Id: PlayGameView.cpp,v 1.6 2003/01/15 14:23:23 nan Exp $ */

// Copyright (C) 2001, 2002, 2003  神南 吉宏(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 "PlayGameView.h"
#include "PlayGame.h"
#include "LoadImage.h"
#include "BaseView.h"

PlayGameView::PlayGameView() {
  m_image = 0;
}

PlayGameView::~PlayGameView() {
  if ( m_image )
    delete m_image;
}

bool
PlayGameView::Init( PlayGame *playGame ) {
  int j, k;

  static char imageFile[30] = "images/Pause";

  m_playGame = playGame;

  char filename[256];
  sprintf( filename, _("%s.pbm"), imageFile );

  m_image = new ImageData();
  m_image->LoadFile( filename );

  SDL_ShowCursor(SDL_DISABLE);
  SDL_WM_GrabInput( SDL_GRAB_ON );

  return true;
}

bool
PlayGameView::Redraw() {
  return true;
}

bool
PlayGameView::RedrawAlpha() {
  glColor4f( 1.0, 1.0, 1.0, 1.0 );

  if ( m_playGame->IsPause() ) {
    glPushMatrix();
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    gluOrtho2D( 0.0, (GLfloat)BaseView::GetWinWidth(),
		0.0, (GLfloat)BaseView::GetWinHeight() );
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glDepthMask(0);

    glRasterPos2i( BaseView::GetWinWidth()/2-128, BaseView::GetWinHeight()/2 );
    glBitmap( 256, 150, 0.0F, 0.0F, 0.0F, 0, m_image->GetImage() );

    glDepthMask(1);

    glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
    glPopMatrix();
  }

  return true;
}