ROLAND  0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
size.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) by Fred Klaus *
3  * development@fkweb.de *
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 *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 #ifndef SDLTK_SIZE_H
21 #define SDLTK_SIZE_H
22 
23 #include "SDL.h"
24 
25 namespace sdltk
26 {
27 
30  class Size
31  {
32  public:
34  Size() {}
36  Size(Uint16 w, Uint16 h) {mWidth = w; mHeight = h;}
38  Size(const Size & s) {mWidth = s.width(); mHeight = s.height();}
39 
41  ~Size() {}
42 
44  Size & operator=(const Size & s)
45  {if (this == &s) return *this; mWidth=s.width(); mHeight=s.height(); return *this;}
47  bool operator==(const Size & s) const
48  {return (mWidth == s.width() && mHeight == s.height()) ? true : false;}
50  bool operator!=(const Size & s) const
51  {return (mWidth != s.width() || mHeight != s.height()) ? true : false;}
52 
54  void clear() {mWidth = 0; mHeight = 0;}
55 
57  Uint16 width() const {return mWidth;}
59  Uint16 height() const {return mHeight;}
60 
61  void setWidth (Uint16 w) {mWidth = w;}
62  void setHeight(Uint16 h) {mHeight = h;}
63  void set(const Size & s) {mWidth = s.width(); mHeight = s.height();}
64  void set(Uint16 w, Uint16 h) {mWidth = w; mHeight = h;}
65  void set(const SDL_Surface * surface) {mWidth = surface->w; mHeight = surface->h;}
66 
67  private:
68  Uint16 mWidth;
69  Uint16 mHeight;
70  };
71 
72 } // sdltk
73 
74 
75 #endif // SDLTK_SIZE_H
bool operator==(const Size &s) const
overloaded operator == true, if width and height are the same
Definition: size.h:47
Size & operator=(const Size &s)
overloaded operator = A deep copy will done, so it's save to assign Size to itself.
Definition: size.h:44
Size(const Size &s)
Copyconstructor. A deep copy will done, so it's save to init Size with itself.
Definition: size.h:38
void setWidth(Uint16 w)
Definition: size.h:61
Size(Uint16 w, Uint16 h)
Constructor. Initializes everything to 0.
Definition: size.h:36
Uint16 mHeight
Definition: size.h:69
Size()
Standard Constructor. Initializes everything to 0.
Definition: size.h:34
Uint16 mWidth
Definition: size.h:68
void clear()
initializes everything to 0.
Definition: size.h:54
~Size()
Standard Destructor. Does nothing.
Definition: size.h:41
defines a planar size (width, height)
Definition: size.h:30
Uint16 height() const
Definition: size.h:59
Uint16 width() const
Definition: size.h:57
void setHeight(Uint16 h)
Definition: size.h:62
bool operator!=(const Size &s) const
overloaded operator != true, if width and height are different
Definition: size.h:50
the SDL based Stuff
Definition: audio.cpp:22