commit some stuff i've been using for testing
This commit is contained in:
@@ -3,10 +3,26 @@
|
|||||||
#include "ScreenTestFonts.h"
|
#include "ScreenTestFonts.h"
|
||||||
#include "FontManager.h"
|
#include "FontManager.h"
|
||||||
#include "RageTextureManager.h"
|
#include "RageTextureManager.h"
|
||||||
|
#include "ScreenManager.h"
|
||||||
|
|
||||||
static const float LineWidth = 400;
|
static const float LineWidth = 400;
|
||||||
static const float LineHeight = 50;
|
static const float LineHeight = 50;
|
||||||
|
|
||||||
|
|
||||||
|
CString CustomText;
|
||||||
|
|
||||||
|
void ChangeText(CString txt)
|
||||||
|
{
|
||||||
|
CustomText = txt;
|
||||||
|
}
|
||||||
|
const ScreenMessage SM_ChangeText = ScreenMessage(SM_User+1);
|
||||||
|
|
||||||
|
void ScreenTestFonts::HandleScreenMessage( const ScreenMessage SM )
|
||||||
|
{
|
||||||
|
if(SM == ScreenMessage(SM_ChangeText))
|
||||||
|
SetText(CustomText);
|
||||||
|
}
|
||||||
|
|
||||||
ScreenTestFonts::ScreenTestFonts()
|
ScreenTestFonts::ScreenTestFonts()
|
||||||
{
|
{
|
||||||
Hline.SetXY(CENTER_X, CENTER_Y);
|
Hline.SetXY(CENTER_X, CENTER_Y);
|
||||||
@@ -19,10 +35,10 @@ ScreenTestFonts::ScreenTestFonts()
|
|||||||
Vline.SetDiffuse( RageColor(0, 1, 0, .8f) );
|
Vline.SetDiffuse( RageColor(0, 1, 0, .8f) );
|
||||||
this->AddChild(&Vline);
|
this->AddChild(&Vline);
|
||||||
|
|
||||||
curfont.SetXY( CENTER_X, CENTER_Y+100 );
|
font.SetXY( CENTER_X, CENTER_Y+100 );
|
||||||
curfont.LoadFromFont( "Themes/default/Fonts/header1" );
|
font.LoadFromFont( "Themes/default/Fonts/header1" );
|
||||||
curfont.SetZoom(.5);
|
font.SetZoom(.5);
|
||||||
this->AddChild(&curfont);
|
this->AddChild(&font);
|
||||||
|
|
||||||
txt.SetXY( CENTER_X, CENTER_Y );
|
txt.SetXY( CENTER_X, CENTER_Y );
|
||||||
SetFont( "Themes/default/Fonts/header1" );
|
SetFont( "Themes/default/Fonts/header1" );
|
||||||
@@ -31,14 +47,17 @@ ScreenTestFonts::ScreenTestFonts()
|
|||||||
|
|
||||||
void ScreenTestFonts::SetText(CString text)
|
void ScreenTestFonts::SetText(CString text)
|
||||||
{
|
{
|
||||||
|
txt.TurnShadowOff();
|
||||||
txt.SetText(""); /* force it */
|
txt.SetText(""); /* force it */
|
||||||
txt.SetText(text);
|
txt.SetText(text);
|
||||||
curtext = text;
|
curtext = text;
|
||||||
}
|
}
|
||||||
void ScreenTestFonts::SetFont(CString font)
|
void ScreenTestFonts::SetFont(CString font_)
|
||||||
{
|
{
|
||||||
txt.LoadFromFont( font );
|
curfont = font_;
|
||||||
curfont.SetText(font);
|
|
||||||
|
txt.LoadFromFont(curfont);
|
||||||
|
font.SetText(curfont);
|
||||||
/* The font changed, so we need to reset the text or it'll be
|
/* The font changed, so we need to reset the text or it'll be
|
||||||
* misaligned. */
|
* misaligned. */
|
||||||
SetText(curtext);
|
SetText(curtext);
|
||||||
@@ -66,9 +85,12 @@ void ScreenTestFonts::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
case '.': txt.SetHorizAlign(align_center); break;
|
case '.': txt.SetHorizAlign(align_center); break;
|
||||||
case '/': txt.SetHorizAlign(align_right); break;
|
case '/': txt.SetHorizAlign(align_right); break;
|
||||||
|
|
||||||
|
case '`': if(curtext != CustomText)
|
||||||
|
SetText(CustomText);
|
||||||
|
else
|
||||||
|
SCREENMAN->TextEntry( SM_ChangeText, "Edit text.", CustomText, ChangeText, NULL);
|
||||||
|
break;
|
||||||
case '1': SetText("Waaai"); break;
|
case '1': SetText("Waaai"); break;
|
||||||
/* These two kanji are currently two different sizes (20 and 32 pix),
|
|
||||||
* and they should be vertically centered with the other text: */
|
|
||||||
case '2': SetText("WAAI &kakumei1;"); break;
|
case '2': SetText("WAAI &kakumei1;"); break;
|
||||||
case '3': SetText("WAAI &oni;"); break;
|
case '3': SetText("WAAI &oni;"); break;
|
||||||
|
|
||||||
@@ -83,6 +105,7 @@ void ScreenTestFonts::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
case 'z': FONT->ReloadFonts();
|
case 'z': FONT->ReloadFonts();
|
||||||
TEXTUREMAN->ReloadAll();
|
TEXTUREMAN->ReloadAll();
|
||||||
SetText(curtext);
|
SetText(curtext);
|
||||||
|
SetFont(curfont);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,14 +10,16 @@ class ScreenTestFonts: public Screen
|
|||||||
public:
|
public:
|
||||||
ScreenTestFonts();
|
ScreenTestFonts();
|
||||||
|
|
||||||
BitmapText txt;
|
|
||||||
BitmapText curfont;
|
|
||||||
Quad Vline, Hline;
|
|
||||||
void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||||
void Draw();
|
void Draw();
|
||||||
CString curtext;
|
void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
void SetText(CString txt);
|
void SetText(CString txt);
|
||||||
void SetFont(CString font);
|
void SetFont(CString font);
|
||||||
|
|
||||||
|
CString curtext, curfont;
|
||||||
|
BitmapText txt, font;
|
||||||
|
Quad Vline, Hline;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user