Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

OrthographicCamera.cpp

00001 #include "LifeVariables.h"
00002 #include "OrthographicCamera.h"
00003 #include "Viewport.h"
00004 
00005 
00006 OrthographicCamera::OrthographicCamera(int left, 
00007                                        int right, 
00008                                        int bottom,
00009                                        int top, 
00010                                        int x, 
00011                                        int y, 
00012                                        int width,
00013                                        int height) 
00014 {
00015     this->left = left;
00016     this->right = right;
00017     this->bottom = bottom;
00018     this->top = top;    
00019     this->x = x;
00020     this->y = y;
00021     this->w = width;
00022     this->h = height;            
00023 }
00024 
00025 
00026 void OrthographicCamera::getLocalWorldCoordinates(int &x, int &y) {
00027     int spaceWidth = this->right - this->left;
00028     int spaceHeight = this->top - this->bottom;
00029 
00030     x = ((float)spaceWidth/this->w)*(x - this->x);
00031     y = ((float)spaceHeight/this->h)*(float)y - ((float)spaceHeight/this->h)*(float)this->y;
00032 }
00033 
00034 
00035 void OrthographicCamera::startCamera(int x, int y, int width, int height) {
00036     this->setViewPort(x,y,width,height);
00037     // setup orthographic proj. with the size defined in the constructor
00038     this->setOrthographicProjection();
00039 }
00040 
00041 
00042 void OrthographicCamera::startCamera() {
00043     this->setViewPort(this->x,this->y,this->w,this->h);
00044     // setup orthographic proj. with the size defined in the constructor
00045     this->setOrthographicProjection();    
00046 }
00047 
00048 
00049 void OrthographicCamera::stopCamera() {
00050     this->resetProjection();
00051     this->resetViewPort();        
00052 }
00053 

Generated on Mon Dec 12 15:20:26 2005 for CCube by  doxygen 1.4.1