TapestryEngine

A 2D Platformer Game Engine
Log | Files | Refs

3bccb653cc443c53fb0fb257d5b641b1fe076892.svn-base (975B)


      1 #ifndef CONSOLE_H
      2 #define CONSOLE_H
      3 
      4 #include "Utils.h"
      5 
      6 
      7 #define LINE_LIMIT 40
      8 #define LINE_SIZE 100
      9 #define CONSOLE_TEXT_LIMIT ((LINE_LIMIT+1)*LINE_SIZE)
     10 
     11 class ConsoleStringManager
     12 {
     13 public:
     14 	ConsoleStringManager();
     15 	
     16 	void AddLine(char* string, int CharCount);
     17 	
     18 	void ConsoleLog(char* msg);
     19 
     20 	void ConsolePrintf(char* fmt, ...);
     21 
     22 	char* GetLine(int x)
     23 	{
     24 		return mLines[x];
     25 	}
     26 
     27 	int GetNextLineIndex()
     28 	{
     29 		return mNextLineIndex;
     30 	}
     31 
     32 protected:
     33 
     34 	char* mLines[LINE_LIMIT];
     35 	int mNextLineIndex;
     36 
     37 	char  mText[CONSOLE_TEXT_LIMIT];
     38 	char* mEndPointer;
     39 
     40 
     41 };
     42 
     43 class Console
     44 {
     45 public:
     46 	Console() {}
     47 
     48 	Console(char* filename, int ptsize, SDL_Color Text, SDL_Color BG);
     49 
     50 	void ConsPrintf(char* fmt, ...);
     51 
     52 	void DrawConsole(SDL_Renderer* ren);
     53 
     54 	void DrawConsoleReadout(SDL_Renderer* ren, int x, int y);
     55 	
     56 protected:
     57 	TTF_Font* mFont;
     58 	SDL_Color mText;
     59 	SDL_Color mBG;
     60 	SDL_Rect mTextRect;
     61 	SDL_Rect mLinePosRect;
     62 	ConsoleStringManager mCSM;
     63 };
     64 
     65 
     66 extern Console* gCons;
     67 
     68 #endif