2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2003-01-09 04:45:49 +00:00
|
|
|
#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"
|
2003-01-18 21:16:08 +00:00
|
|
|
#include "ScreenManager.h"
|
2003-02-26 00:20:00 +00:00
|
|
|
#include "GameConstantsAndTypes.h"
|
2004-09-21 06:07:12 +00:00
|
|
|
#include "ScreenDimensions.h"
|
2003-02-26 00:20:00 +00:00
|
|
|
|
2003-01-09 04:45:49 +00:00
|
|
|
|
|
|
|
|
static const float LineWidth = 400;
|
|
|
|
|
static const float LineHeight = 50;
|
|
|
|
|
|
2003-01-18 21:16:08 +00:00
|
|
|
|
|
|
|
|
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 )
|
2003-01-09 04:45:49 +00:00
|
|
|
{
|
2004-11-05 06:35:10 +00:00
|
|
|
Hline.SetXY(SCREEN_CENTER_X, SCREEN_CENTER_Y);
|
2003-01-09 04:45:49 +00:00
|
|
|
Hline.SetZoomX(LineWidth);
|
|
|
|
|
Hline.SetDiffuse( RageColor(1, 1, 1, 1) );
|
|
|
|
|
this->AddChild(&Hline);
|
|
|
|
|
|
2004-11-05 06:35:10 +00:00
|
|
|
Vline.SetXY(SCREEN_CENTER_X, SCREEN_CENTER_Y);
|
2003-01-09 04:45:49 +00:00
|
|
|
Vline.SetZoomY(LineHeight);
|
|
|
|
|
Vline.SetDiffuse( RageColor(0, 1, 0, .8f) );
|
|
|
|
|
this->AddChild(&Vline);
|
|
|
|
|
|
2004-11-05 06:35:10 +00:00
|
|
|
font.SetXY( SCREEN_CENTER_X, SCREEN_CENTER_Y+100 );
|
2003-07-06 07:08:31 +00:00
|
|
|
font.LoadFromFont( "Themes/default/Fonts/Common Normal" );
|
2003-01-18 21:16:08 +00:00
|
|
|
font.SetZoom(.5);
|
|
|
|
|
this->AddChild(&font);
|
2003-01-10 02:27:23 +00:00
|
|
|
|
2004-11-05 06:35:10 +00:00
|
|
|
txt.SetXY( SCREEN_CENTER_X, SCREEN_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)
|
|
|
|
|
{
|
2004-03-20 02:59:08 +00:00
|
|
|
txt.SetShadowLength( 0 );
|
2003-01-10 02:27:23 +00:00
|
|
|
txt.SetText(""); /* force it */
|
|
|
|
|
txt.SetText(text);
|
|
|
|
|
curtext = text;
|
|
|
|
|
}
|
2003-01-18 21:16:08 +00:00
|
|
|
void ScreenTestFonts::SetFont(CString font_)
|
2003-01-10 02:27:23 +00:00
|
|
|
{
|
2003-01-18 21:16:08 +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-09 04:45:49 +00:00
|
|
|
}
|
|
|
|
|
|
2003-01-10 02:27:23 +00:00
|
|
|
void ScreenTestFonts::Draw()
|
|
|
|
|
{
|
|
|
|
|
/* Draw this manually, so we can breakpoint here ... */
|
|
|
|
|
txt.Draw();
|
|
|
|
|
Screen::Draw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-01-09 04:45:49 +00:00
|
|
|
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;
|
|
|
|
|
|
2003-01-18 21:16:08 +00:00
|
|
|
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 ]bc;"); 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 ]bc;\nWAAI"); break;
|
2003-01-09 04:45:49 +00:00
|
|
|
|
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-09 04:45:49 +00:00
|
|
|
|
2003-01-11 03:56:24 +00:00
|
|
|
case 'z': FONT->ReloadFonts();
|
|
|
|
|
TEXTUREMAN->ReloadAll();
|
|
|
|
|
SetText(curtext);
|
2003-01-18 21:16:08 +00:00
|
|
|
SetFont(curfont);
|
2003-01-11 03:56:24 +00:00
|
|
|
break;
|
2003-01-09 04:45:49 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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.
|
|
|
|
|
*/
|