-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuimanager.h
35 lines (35 loc) · 1 KB
/
uimanager.h
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
#ifndef UIMANAGER_H
#define UIMANAGER_H
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
#include "enums.h"
class Player;
// UIManager:
// Manages Background Scrolling
// Manages Score Displaying
class Player;
class UIManager{
friend class Player;
public:
UIManager( SDL_Renderer* renderer=NULL, SDL_Surface* surface=NULL );
void UpdatePlayerScore( Player *player, int score );
void RenderPlayerScore( const Player *player );
bool RenderBackground( void );
bool ScrollBackground( int player_speed, int direction );
// false : when the clip can't fit screen
// ( refuse the render on false )
// true : successfully rendered the background
private:
SDL_Surface* CreateSurfaceFromText( const char* cstring );
SDL_Renderer* mRenderer;
bool Scrollable( AXIS axis );
SDL_Texture* mBackgroundTextureFull;
SDL_Rect mBackgroundClip;
SDL_Rect mBackgroundClipLast;
SDL_Rect mBackgroundClipFull;
int mWindowWidth;
int mWindowHeight;
TTF_Font* mDefaultFont;
SDL_Color mDefaultFontColor;
};
#endif