Google
Web alhem.net
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

gui::Output Class Reference

#include <Output.h>

Inheritance diagram for gui::Output:

Inheritance graph
[legend]
Collaboration diagram for gui::Output:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Output (Surface *, coord_t x, coord_t y, coord_t w, coord_t h, SurfaceHelper *=NULL)
 ~Output ()
void AddLine (const string &)
void Draw ()

Private Attributes

stringvector_t m_strings
int m_lines

Constructor & Destructor Documentation

gui::Output::Output Surface ,
coord_t  x,
coord_t  y,
coord_t  w,
coord_t  h,
SurfaceHelper = NULL
 

Definition at line 55 of file Output.cpp.

References gui::coord_t.

00056 :Surface(s,x,y,w,h,pclHelper) 00057 { 00058 }

gui::Output::~Output  ) 
 

Definition at line 61 of file Output.cpp.

00062 { 00063 }


Member Function Documentation

void gui::Output::AddLine const string &   ) 
 

Definition at line 66 of file Output.cpp.

References DEB, gui::Surface::GetAbsoluteRect(), gui::Surface::GetH(), gui::Surface::GetTTFont(), m_lines, and m_strings.

00067 { 00068 TTFont *font = GetTTFont(); 00069 stringvector_t::iterator it; 00070 00071 // m_mutex.Lock(); 00072 m_lines = GetH() / font -> GetH(); 00073 while (m_strings.size() < (unsigned)m_lines) 00074 { 00075 m_strings.insert(m_strings.end(), ""); 00076 } 00077 00078 m_strings.insert(m_strings.end(), str); 00079 while (m_strings.size() > (unsigned)m_lines) 00080 { 00081 m_strings.erase(m_strings.begin()); 00082 } 00083 // m_mutex.Unlock(); 00084 SetDirty(true); 00085 // DrawAll(); 00086 // RedrawEv(); 00087 // m_mutex.Lock(); 00088 SDL_Rect r = GetAbsoluteRect(); 00089 r.w = 0; 00090 for (it = m_strings.begin(); it != m_strings.end(); it++) 00091 { 00092 SDL_Rect rect = sge_TTF_TextSize(font -> GetFont(), (char *)(*it).c_str() ); 00093 if (rect.w > r.w) 00094 { 00095 r.w = rect.w; 00096 } 00097 } 00098 // m_mutex.Unlock(); 00099 DEB(printf("InvalidateRectEv(%d,%d,%d,%d)\n",r.x,r.y,r.w,r.h);) 00100 InvalidateRectEv(r); 00101 }

void gui::Output::Draw  )  [virtual]
 

Reimplemented from gui::Surface.

Definition at line 104 of file Output.cpp.

References gui::coord_t, gui::Surface::GetBgColor(), gui::Surface::GetClientRectPtr(), gui::Surface::GetFgColor(), gui::Surface::GetH(), gui::Surface::GetTTFont(), and m_strings.

00105 { 00106 stringvector_t::iterator it; 00107 SDL_Rect *area = GetClientRectPtr(); 00108 Uint32 color; 00109 TTFont *font = GetTTFont(); 00110 SDL_Color fg; 00111 SDL_Color bg; 00112 coord_t x = 0; 00113 coord_t y = font -> GetH(); 00114 00115 color = GetFgColor(); 00116 memmove(&fg,&color,4); 00117 color = GetBgColor(); 00118 memmove(&bg,&color,4); 00119 00120 SDL_FillRect(m_screen, area, color ); 00121 // m_mutex.Lock(); 00122 for (it = m_strings.begin(); it != m_strings.end(); it++) 00123 { 00124 sge_tt_textoutf(m_screen, font -> GetFont(), 00125 x,y, 00126 fg.r,fg.g,fg.b, 00127 bg.r,bg.g,bg.b, 00128 SDL_ALPHA_OPAQUE, 00129 "%s",(*it).c_str()); 00130 y += font -> GetH(); 00131 } 00132 // m_mutex.Unlock(); 00133 }


Member Data Documentation

int gui::Output::m_lines [private]
 

Definition at line 42 of file Output.h.

Referenced by AddLine().

stringvector_t gui::Output::m_strings [private]
 

Definition at line 41 of file Output.h.

Referenced by AddLine(), and Draw().


The documentation for this class was generated from the following files:
Generated for My SDL C++ Gui by doxygen 1.3.6

www.TV-friendship.com
The matchmaking service with an all new twist.

Quantum 'Teleportation'
Some thoughts
Page, code, and content Copyright (C) 2004 by Anders Hedström