Files
itgmania212121/stepmania/src/ScreenTestFonts.cpp
T

139 lines
4.2 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
#include "ScreenTestFonts.h"
2003-01-10 02:27:23 +00:00
#include "FontManager.h"
2003-01-11 03:56:24 +00:00
#include "RageTextureManager.h"
#include "ScreenManager.h"
#include "GameConstantsAndTypes.h"
static const float LineWidth = 400;
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);
}
2003-09-27 22:30:51 +00:00
ScreenTestFonts::ScreenTestFonts( CString sClassName ) : Screen( sClassName )
{
Hline.SetXY(CENTER_X, CENTER_Y);
Hline.SetZoomX(LineWidth);
Hline.SetDiffuse( RageColor(1, 1, 1, 1) );
this->AddChild(&Hline);
Vline.SetXY(CENTER_X, CENTER_Y);
Vline.SetZoomY(LineHeight);
Vline.SetDiffuse( RageColor(0, 1, 0, .8f) );
this->AddChild(&Vline);
font.SetXY( CENTER_X, CENTER_Y+100 );
2003-07-06 07:08:31 +00:00
font.LoadFromFont( "Themes/default/Fonts/Common Normal" );
font.SetZoom(.5);
this->AddChild(&font);
2003-01-10 02:27:23 +00:00
txt.SetXY( CENTER_X, CENTER_Y );
2003-07-06 07:08:31 +00:00
SetFont( "Themes/default/Fonts/Common Normal" );
2003-01-10 02:27:23 +00:00
SetText( "Foo" );
}
void ScreenTestFonts::SetText(CString text)
{
txt.SetShadowLength( 0 );
2003-01-10 02:27:23 +00:00
txt.SetText(""); /* force it */
txt.SetText(text);
curtext = text;
}
void ScreenTestFonts::SetFont(CString font_)
2003-01-10 02:27:23 +00:00
{
curfont = font_;
txt.LoadFromFont(curfont);
font.SetText(curfont);
2003-01-10 02:27:23 +00:00
/* The font changed, so we need to reset the text or it'll be
* misaligned. */
SetText(curtext);
}
2003-01-10 02:27:23 +00:00
void ScreenTestFonts::Draw()
{
/* Draw this manually, so we can breakpoint here ... */
txt.Draw();
Screen::Draw();
}
void ScreenTestFonts::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
if( type != IET_FIRST_PRESS )
return;
switch( DeviceI.button )
{
case '[': txt.SetVertAlign(align_bottom); break;
case '\\': txt.SetVertAlign(align_middle); break;
case ']': txt.SetVertAlign(align_top); break;
case ',': txt.SetHorizAlign(align_left); break;
case '.': txt.SetHorizAlign(align_center); break;
case '/': txt.SetHorizAlign(align_right); break;
case '`': if(curtext != CustomText)
SetText(CustomText);
else
SCREENMAN->TextEntry( SM_ChangeText, "Edit text.", CustomText, ChangeText, NULL);
break;
2003-01-10 02:27:23 +00:00
case '1': SetText("Waaai"); break;
2003-07-06 07:08:31 +00:00
case '2': SetText("WAAI ☩"); break;
case '3': SetText("WAAI &#93bc;"); break;
2003-01-10 02:27:23 +00:00
case '4': SetText("WAAI\nWAAI"); break;
2003-07-06 07:08:31 +00:00
case '5': SetText("WAAI &#93bc;\nWAAI"); break;
2003-07-06 07:08:31 +00:00
case 'q': SetFont( "Themes/default/Fonts/_shared2" ); break;
case 'w': SetFont( "Themes/default/Fonts/Common Normal" ); break;
case 'e': SetFont( "Themes/default/Fonts/MusicList titles" ); break;
case 'r': SetFont( "Themes/default/Fonts/_shared1" ); break;
case 't': SetFont( "Themes/default/Fonts/ScreenRanking letters" ); break;
2003-01-11 03:56:24 +00:00
case 'z': FONT->ReloadFonts();
TEXTUREMAN->ReloadAll();
SetText(curtext);
SetFont(curfont);
2003-01-11 03:56:24 +00:00
break;
}
}
2004-06-08 05:22:33 +00:00
/*
* (c) 2003 Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/