TapestryEngine

A 2D Platformer Game Engine
Log | Files | Refs

Dialogue.h (877B)


      1 #ifndef DIALOGUE_H
      2 #define DIALOGUE_H
      3 
      4 #include "Utils.h"
      5 #include "Console.h"
      6 #include "HUD.h"
      7 
      8 #define DIALOGUE_LINES 4
      9 #define CHAR_PER_LINE 30
     10 #define DIALOGUE_CHAR_LIM (DIALOGUE_LINES * CHAR_PER_LINE)
     11 
     12 struct DialogueLine
     13 {
     14 	SDL_Texture* LineTex;
     15 	bool Displayed;
     16 };
     17 
     18 class Dialogue : public Widget, public EventReceiver //Must subscribe to the player to work
     19 {
     20 public:
     21 
     22 	Dialogue() {}
     23 
     24 	Dialogue(SDL_Rect pos, SDL_Renderer* ren, const char* font, char* text_box, SDL_Color fore, EventReceiver* player);
     25 
     26 	bool TextWrap(int text_pix_max, const char* str);
     27 
     28 	bool DialoguePrint();
     29 
     30 	void CloseDialogue();
     31 
     32 	bool EventProcess(Event eve);
     33 
     34 	bool WidgetUpdate();
     35 
     36 	bool WidgetDraw();
     37 
     38 protected:
     39 
     40 	EventReceiver* mPlayer;
     41 
     42 	TTF_Font* mFont;
     43 
     44 	SDL_Color mText_Color;
     45 
     46 	std::vector<DialogueLine*> mLines_To_Print;
     47 	int mline1;
     48 	int mline2;
     49 
     50 	WidgetElement mText_box;
     51 };
     52 
     53 #endif