Skip to content

Commit

Permalink
Renamed a lot of stupidly named functions
Browse files Browse the repository at this point in the history
Fixed names of a lot of stupidly named functions
  • Loading branch information
lufinkey committed Nov 14, 2014
1 parent 48dce46 commit 6c3f69f
Show file tree
Hide file tree
Showing 22 changed files with 198 additions and 198 deletions.
2 changes: 1 addition & 1 deletion Source/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace SmashBros
}
firstUpdate = false;
}
if(KeyPressed(Keys::ESCAPE) && !PrevKeyPressed(Keys::ESCAPE))
if(getKeyPressed(Keys::ESCAPE) && !getPrevKeyPressed(Keys::ESCAPE))
{
Exit();
}
Expand Down
24 changes: 12 additions & 12 deletions Source/GameEngine/Actor/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ namespace GameEngine
}
else
{
if(Application::MouseState(Mouse::LEFTCLICK) && !Application::PrevMouseState(Mouse::LEFTCLICK))
if(Application::getMouseState(Mouse::LEFTCLICK) && !Application::getPrevMouseState(Mouse::LEFTCLICK))
{
clicking = true;
}
Expand Down Expand Up @@ -497,7 +497,7 @@ namespace GameEngine
}
else
{
if(clicked && !Application::MouseState(Mouse::LEFTCLICK))
if(clicked && !Application::getMouseState(Mouse::LEFTCLICK))
{
releasing = true;
}
Expand Down Expand Up @@ -735,13 +735,13 @@ namespace GameEngine
float mousey = 0;
if(relative)
{
mousex = (float)Application::TouchX(currentTouchId) + View::x;
mousey = (float)Application::TouchY(currentTouchId) + View::y;
mousex = (float)Application::getTouchX(currentTouchId) + View::x;
mousey = (float)Application::getTouchY(currentTouchId) + View::y;
}
else
{
mousex = (float)Application::TouchX(currentTouchId);
mousey = (float)Application::TouchY(currentTouchId);
mousex = (float)Application::getTouchX(currentTouchId);
mousey = (float)Application::getTouchY(currentTouchId);
}

if(checkHover(mousex, mousey))
Expand All @@ -767,13 +767,13 @@ namespace GameEngine
float mousey = 0;
if(relative)
{
mousex = (float)Application::MouseX() + View::x;
mousey = (float)Application::MouseY() + View::y;
mousex = (float)Application::getMouseX() + View::x;
mousey = (float)Application::getMouseY() + View::y;
}
else
{
mousex = (float)Application::MouseX();
mousey = (float)Application::MouseY();
mousex = (float)Application::getMouseX();
mousey = (float)Application::getMouseY();
}

return checkHover(mousex, mousey);
Expand Down Expand Up @@ -1242,11 +1242,11 @@ namespace GameEngine
left1 = (int)(x-(w/2));
left2 = (int)View::x;
right1 = (int)(x+(w/2));
right2 = (int)(View::x+(View::ScaleWidth()));
right2 = (int)(View::x+(View::getScalingWidth()));
top1 = (int)(y-(h/2));
top2 = (int)View::y;
bottom1 = (int)(y+(h/2));
bottom2 = (int)(View::y+(View::ScaleHeight()));
bottom2 = (int)(View::y+(View::getScalingHeight()));

if (bottom1 < top2)
{
Expand Down
6 changes: 3 additions & 3 deletions Source/GameEngine/Actor/TextActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,11 @@ namespace GameEngine
left1 = (int)rect.x;
left2 = (int)View::x;
right1 = (int)rect.x+rect.width;
right2 = (int)View::x+(View::ScaleWidth());
right2 = (int)View::x+(View::getScalingWidth());
top1 = (int)rect.y;
top2 = (int)View::y;
bottom1 = (int)rect.y+rect.height;
bottom2 = (int)View::y+(View::ScaleHeight());
bottom2 = (int)View::y+(View::getScalingHeight());

if (bottom1 < top2)
{
Expand Down Expand Up @@ -777,7 +777,7 @@ namespace GameEngine
{
if(Application::checkTouchActive(currentTouchId))
{
if(checkHover((float)Application::TouchX(currentTouchId), (float)Application::TouchY(currentTouchId)))
if(checkHover((float)Application::getTouchX(currentTouchId), (float)Application::getTouchY(currentTouchId)))
{
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions Source/GameEngine/Actor/WireframeActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ namespace GameEngine
{
if(Application::checkTouchActive(currentTouchId))
{
if(checkHover((float)Application::TouchX(currentTouchId), (float)Application::TouchY(currentTouchId)))
if(checkHover((float)Application::getTouchX(currentTouchId), (float)Application::getTouchY(currentTouchId)))
{
return true;
}
Expand Down Expand Up @@ -595,11 +595,11 @@ namespace GameEngine
left1 = (int)x;
left2 = (int)View::x;
right1 = (int)x+width;
right2 = (int)View::x+(View::ScaleWidth());
right2 = (int)View::x+(View::getScalingWidth());
top1 = (int)y;
top2 = (int)View::y;
bottom1 = (int)y+height;
bottom2 = (int)View::y+(View::ScaleHeight());
bottom2 = (int)View::y+(View::getScalingHeight());

if (bottom1 < top2)
{
Expand Down
32 changes: 16 additions & 16 deletions Source/GameEngine/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ namespace GameEngine
if(bgVisible)
{
BufferedImage*img = AssetManager::getImage(bgName);
graphics->drawImage(img,0,0,(float)View::ScaleWidth(),(float)View::ScaleHeight(),0,0,img->getWidth(),img->getHeight());
graphics->drawImage(img,0,0,(float)View::getScalingWidth(),(float)View::getScalingHeight(),0,0,img->getWidth(),img->getHeight());
}
this->Draw(*graphics,worldTime);
if(!paused)
Expand Down Expand Up @@ -433,7 +433,7 @@ namespace GameEngine
{
SDL_SetRenderDrawColor(renderer, 0,0,0,255);
SDL_RenderClear(renderer);
graphics->drawImage(loadImage,0,0,(float)View::ScaleWidth(),(float)View::ScaleHeight(),0,0,loadImage->getWidth(),loadImage->getHeight());
graphics->drawImage(loadImage,0,0,(float)View::getScalingWidth(),(float)View::getScalingHeight(),0,0,loadImage->getWidth(),loadImage->getHeight());
graphics->setColor(loadbarColor);
graphics->fillRect(loadbarDim[0], loadbarDim[1], (float)((float)(loadCurrent/loadTotal)*loadbarDim[2]), loadbarDim[3]);
SDL_RenderPresent(renderer);
Expand Down Expand Up @@ -592,32 +592,32 @@ namespace GameEngine
return result;
}

int Application::GetLastKey()
int Application::getLastKey()
{
return currentLastKey;
}

bool Application::KeyPressed(int key) //check if a key is pressed
bool Application::getKeyPressed(int key) //check if a key is pressed
{
return currentKeyState[key];
}

bool Application::PrevKeyPressed(int key) //check if a key was pressed in the last frame
bool Application::getPrevKeyPressed(int key) //check if a key was pressed in the last frame
{
return prevKeyState[key];
}

bool Application::MouseState(int state)
bool Application::getMouseState(int state)
{
return currentMouseState[state];
}

bool Application::PrevMouseState(int state)
bool Application::getPrevMouseState(int state)
{
return prevMouseState[state];
}

int Application::MouseX()
int Application::getMouseX()
{
if(scalescreen)
{
Expand All @@ -629,7 +629,7 @@ namespace GameEngine
}
}

int Application::PrevMouseX()
int Application::getPrevMouseX()
{
if(scalescreen)
{
Expand All @@ -641,7 +641,7 @@ namespace GameEngine
}
}

int Application::MouseY()
int Application::getMouseY()
{
if(scalescreen)
{
Expand All @@ -653,7 +653,7 @@ namespace GameEngine
}
}

int Application::PrevMouseY()
int Application::getPrevMouseY()
{
if(scalescreen)
{
Expand All @@ -665,7 +665,7 @@ namespace GameEngine
}
}

int Application::TouchX(long touchID)
int Application::getTouchX(long touchID)
{
TouchPoint*point = getTouchPoint(touchID);
if(point==NULL)
Expand All @@ -682,7 +682,7 @@ namespace GameEngine
}
}

int Application::PrevTouchX(long touchID)
int Application::getPrevTouchX(long touchID)
{
TouchPoint*point = getPrevTouchPoint(touchID);
if(point==NULL)
Expand All @@ -699,7 +699,7 @@ namespace GameEngine
}
}

int Application::TouchY(long touchID)
int Application::getTouchY(long touchID)
{
TouchPoint*point = getTouchPoint(touchID);
if(point==NULL)
Expand All @@ -716,7 +716,7 @@ namespace GameEngine
}
}

int Application::PrevTouchY(long touchID)
int Application::getPrevTouchY(long touchID)
{
TouchPoint*point = getPrevTouchPoint(touchID);
if(point==NULL)
Expand Down Expand Up @@ -1127,7 +1127,7 @@ namespace GameEngine
if(showLoad)
{
BufferedImage*img = AssetManager::getImage(loadScreen);
graphics->drawImage(img,0,0,(float)View::ScaleWidth(),(float)View::ScaleHeight(),0,0,img->getWidth(),img->getHeight());
graphics->drawImage(img,0,0,(float)View::getScalingWidth(),(float)View::getScalingHeight(),0,0,img->getWidth(),img->getHeight());
}*/
graphics->setColor(loadbarColor);
graphics->fillRect(loadbarDim[0], loadbarDim[1], (float)((float)(loadCurrent/loadTotal)*loadbarDim[2]), loadbarDim[3]);
Expand Down
28 changes: 14 additions & 14 deletions Source/GameEngine/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,20 @@ namespace GameEngine
static void showMessage(const String&title, const String&message);
static int showMessage(const String&title, const String&message, const ArrayList<String>&options);

static int GetLastKey();
static bool KeyPressed(int key);
static bool PrevKeyPressed(int key);

static bool MouseState(int state);
static bool PrevMouseState(int state);
static int MouseX();
static int MouseY();
static int PrevMouseX();
static int PrevMouseY();
static int TouchX(long touchID);
static int PrevTouchX(long touchID);
static int TouchY(long touchID);
static int PrevTouchY(long touchID);
static int getLastKey();
static bool getKeyPressed(int key);
static bool getPrevKeyPressed(int key);

static bool getMouseState(int state);
static bool getPrevMouseState(int state);
static int getMouseX();
static int getMouseY();
static int getPrevMouseX();
static int getPrevMouseY();
static int getTouchX(long touchID);
static int getPrevTouchX(long touchID);
static int getTouchY(long touchID);
static int getPrevTouchY(long touchID);
static bool checkTouchActive(long touchID);
static bool checkPrevTouchActive(long touchID);
static ArrayList<TouchPoint> getTouchPoints();
Expand Down
12 changes: 6 additions & 6 deletions Source/GameEngine/Graphics/Graphics2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ namespace GameEngine
SDL_Rect rect;
rect.x = 0;
rect.y = 0;
rect.w = View::Width();
rect.h = View::Height();
rect.w = View::getWidth();
rect.h = View::getHeight();
SDL_RenderSetViewport(renderer, &rect);
}

Expand Down Expand Up @@ -72,16 +72,16 @@ namespace GameEngine
srcrect.top += lev;
dstrect.top += (float)((lev/srcH)*dstH);
}
if(dstrect.right > View::Width())
if(dstrect.right > View::getWidth())
{
float dif = dstrect.right - View::Width();
float dif = dstrect.right - View::getWidth();
float lev = (float)((int)((dif/dstW)*srcW));
srcrect.right -= lev;
dstrect.right -= (float)((lev/srcW)*dstW);
}
if(dstrect.bottom > View::Height())
if(dstrect.bottom > View::getHeight())
{
float dif = dstrect.bottom - View::Height();
float dif = dstrect.bottom - View::getHeight();
float lev = (float)((int)((dif/dstH)*srcH));
srcrect.bottom -= lev;
dstrect.bottom -= (float)((lev/srcH)*dstH);
Expand Down
4 changes: 2 additions & 2 deletions Source/GameEngine/ScreenManager/MenuScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace GameEngine
}
else
{
if(Application::MouseState(Mouse::LEFTCLICK))
if(Application::getMouseState(Mouse::LEFTCLICK))
{
selecting = true;
}
Expand Down Expand Up @@ -115,7 +115,7 @@ namespace GameEngine
}
}

if(selectedIndex>=0 && !Application::MouseState(Mouse::LEFTCLICK) && Application::PrevMouseState(Mouse::LEFTCLICK))
if(selectedIndex>=0 && !Application::getMouseState(Mouse::LEFTCLICK) && Application::getPrevMouseState(Mouse::LEFTCLICK))
{
Items.get(selectedIndex)->OnRelease();
Items.get(selectedIndex)->setSelected(false);
Expand Down
8 changes: 4 additions & 4 deletions Source/GameEngine/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ namespace GameEngine
scaleHeight=h;
}

int View::Width()
int View::getWidth()
{
return windowWidth;
}

int View::Height()
int View::getHeight()
{
return windowHeight;
}

int View::ScaleWidth()
int View::getScalingWidth()
{
return scaleWidth;
}

int View::ScaleHeight()
int View::getScalingHeight()
{
return scaleHeight;
}
Expand Down
8 changes: 4 additions & 4 deletions Source/GameEngine/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ namespace GameEngine
static void setSize(int w, int h);
static void setScaleSize(int w, int h);

static int Width();
static int Height();
static int ScaleWidth();
static int ScaleHeight();
static int getWidth();
static int getHeight();
static int getScalingWidth();
static int getScalingHeight();

static void Update(Graphics2D& g);
static void Draw(Graphics2D& g);
Expand Down
Loading

0 comments on commit 6c3f69f

Please sign in to comment.