mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-20 12:19:10 +00:00
Merged in cwalther/cwe/textrendering (pull request #36)
Shadowed Chat and Player List Text This implements the (existing but unimplemented) plDynamicTextMap::kFontShadowed flag, making the text of the mini KI (player list and chat) better readable on light and patterned backgrounds. For best results, an additional Python change is recommended: MOULSCRIPT-ou PR #23. From H-uru/Plasma#392.
This commit is contained in:
@ -56,6 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "../pnMessage/plRefMsg.h"
|
||||
#include "../pnMessage/plEnableMsg.h"
|
||||
#include "../pfMessage/pfGameGUIMsg.h"
|
||||
#include "../plMessage/plDeviceRecreateMsg.h"
|
||||
#include "../pnSceneObject/plDrawInterface.h"
|
||||
#include "../pnSceneObject/plCoordinateInterface.h"
|
||||
#include "../pnSceneObject/plAudioInterface.h"
|
||||
@ -584,14 +585,16 @@ plProfile_CreateTimer("Gui", "RenderSetup", GUITime);
|
||||
hsBool pfGUIControlMod::MsgReceive( plMessage *msg )
|
||||
{
|
||||
plRenderMsg* rend = plRenderMsg::ConvertNoRef( msg );
|
||||
plDeviceRecreateMsg* device = plDeviceRecreateMsg::ConvertNoRef(msg);
|
||||
if (rend || device) {
|
||||
plPipeline* pipe = rend ? rend->Pipeline() : device->Pipeline();
|
||||
|
||||
if( rend )
|
||||
{
|
||||
plProfile_BeginLap(GUITime, this->GetKey()->GetUoid().GetObjectName());
|
||||
// Only need it once
|
||||
if( ISetUpDynTextMap( rend->Pipeline() ) )
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType( plRenderMsg::Index(), GetKey() );
|
||||
ISetUpDynTextMap(pipe);
|
||||
plProfile_EndLap(GUITime, this->GetKey()->GetUoid().GetObjectName());
|
||||
|
||||
if (rend)
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType(plRenderMsg::Index(), GetKey());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -603,12 +606,16 @@ hsBool pfGUIControlMod::MsgReceive( plMessage *msg )
|
||||
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
|
||||
{
|
||||
fDynTextMap = plDynamicTextMap::ConvertNoRef( refMsg->GetRef() );
|
||||
// Register for a render msg so we can leech the material when we finally
|
||||
// have a pipeline to work with
|
||||
|
||||
// These tell us when we need to (re-)initialize the DTM
|
||||
plgDispatch::Dispatch()->RegisterForExactType( plRenderMsg::Index(), GetKey() );
|
||||
plgDispatch::Dispatch()->RegisterForExactType( plDeviceRecreateMsg::Index(), GetKey() );
|
||||
}
|
||||
else
|
||||
{
|
||||
fDynTextMap = nil;
|
||||
plgDispatch::Dispatch()->UnRegisterForExactType( plDeviceRecreateMsg::Index(), GetKey() );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if( refMsg->fType == kRefDynTextLayer )
|
||||
@ -688,7 +695,7 @@ hsBool pfGUIControlMod::ISetUpDynTextMap( plPipeline *pipe )
|
||||
extraH -= height;
|
||||
|
||||
fDynTextMap->Reset();
|
||||
fDynTextMap->Create( width, height, HasFlag( kXparentBgnd ), extraW, extraH );
|
||||
fDynTextMap->Create( width, height, HasFlag( kXparentBgnd ), extraW, extraH, true );
|
||||
|
||||
fDynTextMap->SetFont( GetColorScheme()->fFontFace, GetColorScheme()->fFontSize, GetColorScheme()->fFontFlags,
|
||||
HasFlag( kXparentBgnd ) ? false : true );
|
||||
@ -699,6 +706,7 @@ hsBool pfGUIControlMod::ISetUpDynTextMap( plPipeline *pipe )
|
||||
// out with 1:1 mapping from textel to pixel
|
||||
plLayer *layer = (plLayer *)fDynTextLayer;
|
||||
layer->SetTransform( fDynTextMap->GetLayerTransform() );
|
||||
layer->SetBlendFlags( layer->GetBlendFlags() | hsGMatState::kBlendAlphaPremultiplied );
|
||||
|
||||
// Let the derived classes do their things
|
||||
IPostSetUpDynTextMap();
|
||||
|
@ -247,6 +247,8 @@ class pfGUIControlMod : public plSingleModifier
|
||||
virtual void SetColorScheme( pfGUIColorScheme *newScheme );
|
||||
pfGUIColorScheme *GetColorScheme( void ) const;
|
||||
|
||||
virtual void UpdateColorScheme() { IPostSetUpDynTextMap(); IUpdate(); }
|
||||
|
||||
// should be override by specific GUIcontrol
|
||||
virtual void PurgeDynaTextMapImage() {;}
|
||||
|
||||
|
@ -197,9 +197,9 @@ void pfGUIEditBoxMod::IUpdate( void )
|
||||
oldCursorPos = cursorPos;
|
||||
cursorPos -= (Int16)fScrollPos;
|
||||
|
||||
if( 4 + cursorPos > fDynTextMap->GetVisibleWidth() - 18 )
|
||||
if( 4 + cursorPos > fDynTextMap->GetVisibleWidth() - 4 - 2 )
|
||||
{
|
||||
fScrollPos += ( 4 + cursorPos ) - ( fDynTextMap->GetVisibleWidth() - 18 );
|
||||
fScrollPos += ( 4 + cursorPos ) - ( fDynTextMap->GetVisibleWidth() - 4 - 2 );
|
||||
}
|
||||
else if( 4 + cursorPos < 4 )
|
||||
{
|
||||
|
@ -180,6 +180,10 @@ hsBool pfGUIListBoxMod::MsgReceive( plMessage *msg )
|
||||
|
||||
void pfGUIListBoxMod::IPostSetUpDynTextMap( void )
|
||||
{
|
||||
pfGUIColorScheme *scheme = GetColorScheme();
|
||||
fDynTextMap->SetFont( scheme->fFontFace, scheme->fFontSize, scheme->fFontFlags,
|
||||
!HasFlag( kXparentBgnd ));
|
||||
|
||||
ICalcWrapStarts();
|
||||
ICalcScrollRange();
|
||||
fReadyToRoll = true;
|
||||
|
@ -216,6 +216,8 @@ class pfGUIMultiLineEditCtrl : public pfGUIControlMod
|
||||
|
||||
virtual void PurgeDynaTextMapImage();
|
||||
|
||||
virtual void UpdateColorScheme() { fFontFlagsSet = 0; pfGUIControlMod::UpdateColorScheme(); }
|
||||
|
||||
// Extended event types
|
||||
enum ExtendedEvents
|
||||
{
|
||||
|
@ -102,8 +102,6 @@ class pfGUITextBoxMod : public pfGUIControlMod
|
||||
void SetLocalizationPath(const wchar_t* path);
|
||||
void SetLocalizationPath(const char* path);
|
||||
void SetUseLocalizationPath(bool use);
|
||||
|
||||
virtual void UpdateColorScheme() { IPostSetUpDynTextMap(); IUpdate(); }
|
||||
};
|
||||
|
||||
#endif // _pfGUITextBoxMod_h
|
||||
|
Reference in New Issue
Block a user