Changeset 724
- Timestamp:
- 07/12/09 03:20:07 (13 months ago)
- Location:
- trunk/client/Game2
- Files:
-
- 2 modified
-
FullscreenTest.cpp (modified) (6 diffs)
-
FullscreenTest.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/Game2/FullscreenTest.cpp
r722 r724 34 34 #include "FullscreenTest.h" 35 35 36 using boost::format; 37 using boost::str; 38 36 39 using namespace HoverRace::Client; 37 40 using namespace HoverRace::Util; … … 47 50 oldX(oldX), oldY(oldY), oldMonitor(oldMonitor), 48 51 viewport(new MR_2DViewPort()), widgetsInitialized(false), 49 heading(NULL), 52 heading(NULL), subheading(NULL), 50 53 timeRemaining(5) 51 54 { … … 54 57 FullscreenTest::~FullscreenTest() 55 58 { 59 delete subheading; 56 60 delete heading; 57 61 delete viewport; … … 92 96 } 93 97 94 void FullscreenTest::InitWidgets(int resY)98 int FullscreenTest::ScaleFont(int i, int resY) 95 99 { 96 Font headingFont("Arial", 20 * resY / 480, true); 100 // Assume that font sizes given are relative to a 640x480 screen. 101 return i * resY / 480; 102 } 103 104 void FullscreenTest::UpdateSubheading(int resY) 105 { 106 // Keep these translations short -- the user doesn't have much time to read them! 107 const char *text = ngettext( 108 "Returning in %d second.", 109 "Returning in %d seconds.", 110 timeRemaining); 111 std::string subheadingStr = str(format(text) % timeRemaining); 112 if (subheading == NULL) { 113 Font subheadingFont("Arial", ScaleFont(16, resY), true); 114 subheading = new StaticText(subheadingStr, subheadingFont, 0x10); 115 } 116 else { 117 subheading->SetText(subheadingStr); 118 } 119 } 120 121 void FullscreenTest::InitWidgets(int resX, int resY) 122 { 123 Font headingFont("Arial", ScaleFont(20, resY), true); 97 124 98 heading = new StaticText(_("HoverRace fullscreen settings test"), headingFont, 0x08); 125 // Keep these translations short -- the user doesn't have much time to read them! 126 std::string headingStr = _("HoverRace fullscreen test"); 127 headingStr += ": "; 128 headingStr += str(format("%dx%d", OS::stdLocale) % resX % resY); 129 heading = new StaticText(headingStr, headingFont, 0x0c); 99 130 } 100 131 … … 110 141 int resY = dest->GetYRes(); 111 142 if (!widgetsInitialized) { 112 InitWidgets(res Y);143 InitWidgets(resX, resY); 113 144 widgetsInitialized = true; 114 145 } 146 UpdateSubheading(resY); 115 147 116 148 dest->Lock(); … … 121 153 int curY = resY / 2 - heading->GetHeight(); 122 154 heading->Blt(leftMargin, curY, viewport); 123 //curY += heading->GetHeight(); 155 curY += heading->GetHeight(); 156 157 subheading->Blt(leftMargin, curY, viewport); 124 158 125 159 dest->Unlock(); 126 160 } 127 -
trunk/client/Game2/FullscreenTest.h
r722 r724 49 49 50 50 private: 51 void InitWidgets(int resY); 51 static int ScaleFont(int i, int resY); 52 void UpdateSubheading(int resY); 53 void InitWidgets(int resX, int resY); 52 54 public: 53 55 void Render(MR_VideoBuffer *dest); … … 60 62 bool widgetsInitialized; 61 63 VideoServices::StaticText *heading; 64 VideoServices::StaticText *subheading; 62 65 63 66 int timeRemaining;
