~ubuntu-branches/ubuntu/precise/pingus/precise

« back to all changes in this revision

Viewing changes to src/resource_modifier.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Cyril Brulebois
  • Date: 2008-02-28 19:44:25 UTC
  • mfrom: (4.1.4 hardy)
  • Revision ID: james.westby@ubuntu.com-20080228194425-e8ilohlijv02kgcf
Tags: 0.7.2-2
* Fix FTBFS with gcc-4.3 by adding the missing include in
  src/input/evdev_device.cpp (Closes: #462238):
   + debian/patches/20_fix_FTBFS_with_gcc-4.3.
* Rename former patch so that the filename reflects the order in which
  the patches are applied:
   - debian/patches/data_dir.patch
   + debian/patches/10_fix_data_directory.
* Bump Standards-Version from 3.7.2 to 3.7.3, no changes needed.
* Add a dh_desktop call in the arch-dep part of debian/rules.
* Adjust the “missing-dep-for-interpreter guile” override since lintian
  now lists an alternative for that dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//  $Id: resource_modifier.cxx,v 1.2 2002/09/11 12:45:57 grumbel Exp $
2
 
//
3
 
//  Pingus - A free Lemmings clone
4
 
//  Copyright (C) 2000 Ingo Ruhnke <grumbel@gmx.de>
5
 
//
6
 
//  This program is free software; you can redistribute it and/or
7
 
//  modify it under the terms of the GNU General Public License
8
 
//  as published by the Free Software Foundation; either version 2
9
 
//  of the License, or (at your option) any later version.
10
 
//
11
 
//  This program is distributed in the hope that it will be useful,
12
 
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
//  GNU General Public License for more details.
15
 
//
16
 
//  You should have received a copy of the GNU General Public License
17
 
//  along with this program; if not, write to the Free Software
18
 
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
 
 
20
 
#include <assert.h>
21
 
#include "resource_modifier.hxx"
22
 
 
23
 
namespace ResourceModifierNS {
24
 
 
25
 
ResourceModifier horizontal_flip (ResourceModifier modifier)
26
 
{
27
 
  switch (modifier)
28
 
    {
29
 
    case ROT0:
30
 
      return ROT0FLIP;
31
 
    case ROT90:
32
 
      return ROT90FLIP;
33
 
    case ROT180:
34
 
      return ROT180FLIP;        
35
 
    case ROT270:
36
 
      return ROT270FLIP;
37
 
    case ROT0FLIP:
38
 
      return ROT0;
39
 
    case ROT90FLIP:
40
 
      return ROT90;
41
 
    case ROT180FLIP:
42
 
      return ROT180;
43
 
    case ROT270FLIP:
44
 
      return ROT270;
45
 
    default:
46
 
      assert (0);
47
 
      return ROT0;
48
 
    }
49
 
}
50
 
 
51
 
ResourceModifier vertical_flip (ResourceModifier modifier)
52
 
{
53
 
  switch (modifier)
54
 
    {
55
 
    case ROT0:
56
 
      return ROT180FLIP;
57
 
    case ROT90:
58
 
      return ROT270FLIP;
59
 
    case ROT180:
60
 
      return ROT0FLIP;
61
 
    case ROT270:
62
 
      return ROT90FLIP;
63
 
    case ROT0FLIP:
64
 
      return ROT180;
65
 
    case ROT90FLIP:
66
 
      return ROT270;
67
 
    case ROT180FLIP:
68
 
      return ROT0;
69
 
    case ROT270FLIP:
70
 
      return ROT90;
71
 
    default:
72
 
      assert (0);
73
 
      return ROT0;
74
 
    }
75
 
}
76
 
 
77
 
ResourceModifier rotate_90 (ResourceModifier modifier)
78
 
{
79
 
  switch (modifier)
80
 
    {
81
 
    case ROT0:
82
 
      return ROT90;
83
 
    case ROT90:
84
 
      return ROT180;
85
 
    case ROT180:
86
 
      return ROT270;                    
87
 
    case ROT270:
88
 
      return ROT0;
89
 
    case ROT0FLIP:
90
 
      return ROT270FLIP;
91
 
    case ROT90FLIP:
92
 
      return ROT0FLIP;
93
 
    case ROT180FLIP:
94
 
      return ROT90FLIP;
95
 
    case ROT270FLIP:
96
 
      return ROT180FLIP;
97
 
    default:
98
 
      assert (0);
99
 
      return ROT0;
100
 
    }
101
 
}
102
 
 
103
 
ResourceModifier rotate_270 (ResourceModifier modifier)
104
 
{
105
 
  switch (modifier)
106
 
    {
107
 
    case ROT0:
108
 
      return ROT270;
109
 
    case ROT90:
110
 
      return ROT0;
111
 
    case ROT180:
112
 
      return ROT90;     
113
 
    case ROT270:
114
 
      return ROT180;
115
 
    case ROT0FLIP:
116
 
      return ROT90FLIP;
117
 
    case ROT90FLIP:
118
 
      return ROT180FLIP;
119
 
    case ROT180FLIP:
120
 
      return ROT270FLIP;
121
 
    case ROT270FLIP:
122
 
      return ROT0FLIP;
123
 
    default:
124
 
      assert (0);
125
 
      return ROT0;
126
 
    }
127
 
}
128
 
 
129
 
std::string rs_to_string (ResourceModifier modifier)
130
 
{
131
 
  switch (modifier)
132
 
    {
133
 
    case ROT0:
134
 
      return "ROT0";
135
 
    case ROT90:
136
 
      return "ROT90";
137
 
    case ROT180:
138
 
      return "ROT180";  
139
 
    case ROT270:
140
 
      return "ROT270";
141
 
    case ROT0FLIP:
142
 
      return "ROT0FLIP";
143
 
    case ROT90FLIP:
144
 
      return "ROT90FLIP";
145
 
    case ROT180FLIP:
146
 
      return "ROT180FLIP";
147
 
    case ROT270FLIP:
148
 
      return "ROT270FLIP";
149
 
    default:
150
 
      assert (0);
151
 
      return "--Error--";
152
 
    } 
153
 
}
154
 
 
155
 
ResourceModifier rs_from_string (const std::string& modifier)
156
 
{
157
 
  if (modifier == "ROT0")
158
 
    return ROT0;
159
 
  else if (modifier == "ROT90")
160
 
    return ROT90;
161
 
  else if (modifier == "ROT180")
162
 
    return ROT180;
163
 
  else if (modifier == "ROT270")
164
 
    return ROT270;
165
 
  else if (modifier == "ROT0FLIP")
166
 
    return ROT0FLIP;
167
 
  else if (modifier == "ROT90FLIP")
168
 
    return ROT90FLIP;
169
 
  else if (modifier == "ROT180FLIP")
170
 
    return ROT180FLIP;
171
 
  else if (modifier == "ROT270FLIP")
172
 
    return ROT270FLIP;
173
 
  else
174
 
    {
175
 
      assert (0);
176
 
      return ROT0;
177
 
    }
178
 
}
179
 
 
180
 
} // namespace ResourceModifierNS
181
 
 
182
 
/* EOF */