* (Windows) Mouse-controlled screens in DMODs control better and hide the original mouse cursor
* (Windows) Now remembers screen size and fullscreen mode (don't forget, you can drag the window corners around to customize the screen size as well) * (Windows) Input URL input area gets focus by default when installing a DMOD by URL * (bugfix) Can no longer tap F8 during a game load to load a save state too early which can freeze the game * (bugfix) Fixed issue where 32 bit tilebitmaps would go wonky when reloading the surface * Default color under status bar is now black, fixes issue when transparent colors are used in the stats area, random garbage would show through git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1473 353e56fe-9613-0410-8469-b96ad8e6f29c
This commit is contained in:
parent
f7cc1910ce
commit
e3ad75909f
9 changed files with 500 additions and 279 deletions
|
@ -1,165 +1,165 @@
|
|||
#include "PlatformPrecomp.h"
|
||||
#include "ActionButtonComponent.h"
|
||||
#include "util/GLESUtils.h"
|
||||
#include "Entity/EntityUtils.h"
|
||||
#include "BaseApp.h"
|
||||
#include "../dink/dink.h"
|
||||
|
||||
ActionButtonComponent::ActionButtonComponent()
|
||||
{
|
||||
SetName("ActionButton");
|
||||
m_mode = MODE_MAGIC;
|
||||
}
|
||||
|
||||
ActionButtonComponent::~ActionButtonComponent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ActionButtonComponent::OnAdd(Entity *pEnt)
|
||||
{
|
||||
EntityComponent::OnAdd(pEnt);
|
||||
|
||||
m_pPos2d = &GetParent()->GetVar("pos2d")->GetVector2();
|
||||
|
||||
if (GetParent()->GetName() != "magic")
|
||||
{
|
||||
m_mode = MODE_WEAPON;
|
||||
}
|
||||
/*
|
||||
m_pSize2d = &GetParent()->GetVar("size2d")->GetVector2();
|
||||
m_pScale = &GetParent()->GetShared()->GetVarWithDefault("scale", Variant(1.0f))->GetFloat();
|
||||
#include "PlatformPrecomp.h"
|
||||
#include "ActionButtonComponent.h"
|
||||
#include "util/GLESUtils.h"
|
||||
#include "Entity/EntityUtils.h"
|
||||
#include "BaseApp.h"
|
||||
#include "../dink/dink.h"
|
||||
|
||||
ActionButtonComponent::ActionButtonComponent()
|
||||
{
|
||||
SetName("ActionButton");
|
||||
m_mode = MODE_MAGIC;
|
||||
}
|
||||
|
||||
ActionButtonComponent::~ActionButtonComponent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ActionButtonComponent::OnAdd(Entity *pEnt)
|
||||
{
|
||||
EntityComponent::OnAdd(pEnt);
|
||||
|
||||
m_pPos2d = &GetParent()->GetVar("pos2d")->GetVector2();
|
||||
|
||||
if (GetParent()->GetName() != "magic")
|
||||
{
|
||||
m_mode = MODE_WEAPON;
|
||||
}
|
||||
/*
|
||||
m_pSize2d = &GetParent()->GetVar("size2d")->GetVector2();
|
||||
m_pScale = &GetParent()->GetShared()->GetVarWithDefault("scale", Variant(1.0f))->GetFloat();
|
||||
m_pRotation = &GetParent()->GetVar("rotation")->GetFloat(); //in degrees
|
||||
|
||||
m_pColor = &GetParent()->GetShared()->GetVarWithDefault("color", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
|
||||
m_pColorMod = &GetParent()->GetShared()->GetVarWithDefault("colorMod", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
|
||||
|
||||
m_pColor = &GetParent()->GetShared()->GetVarWithDefault("color", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
|
||||
m_pColorMod = &GetParent()->GetShared()->GetVarWithDefault("colorMod", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
|
||||
m_pAlignment = &GetParent()->GetVar("alignment")->GetUINT32();
|
||||
*/
|
||||
|
||||
m_pAlpha = &GetParent()->GetShared()->GetVarWithDefault("alpha", Variant(1.0f))->GetFloat();
|
||||
m_pAlpha = &GetParent()->GetShared()->GetVarWithDefault("alpha", Variant(1.0f))->GetFloat();
|
||||
|
||||
//register ourselves to render if the parent does
|
||||
GetParent()->GetFunction("OnRender")->sig_function.connect(1, boost::bind(&ActionButtonComponent::OnRender, this, _1));
|
||||
GetParent()->GetFunction("OnUpdate")->sig_function.connect(1, boost::bind(&ActionButtonComponent::OnUpdate, this, _1));
|
||||
|
||||
UpdateIcon();
|
||||
}
|
||||
|
||||
void ActionButtonComponent::OnRemove()
|
||||
{
|
||||
EntityComponent::OnRemove();
|
||||
}
|
||||
|
||||
void ActionButtonComponent::OnRender(VariantList *pVList)
|
||||
{
|
||||
CL_Vec2f vFinalPos = pVList->m_variant[0].GetVector2()+*m_pPos2d;
|
||||
|
||||
Surface *pSurf;
|
||||
|
||||
switch (m_mode)
|
||||
{
|
||||
case MODE_MAGIC:
|
||||
pSurf = DinkGetMagicIconImage();
|
||||
break;
|
||||
|
||||
case MODE_WEAPON:
|
||||
pSurf = DinkGetWeaponIconImage();
|
||||
break;
|
||||
}
|
||||
|
||||
if (pSurf)
|
||||
{
|
||||
rtRectf srcRect = pSurf->GetRectf();
|
||||
rtRectf dstRect = srcRect;
|
||||
|
||||
if (IsLargeScreen())
|
||||
{
|
||||
|
||||
dstRect = rtRectf(0,0, 90,90);
|
||||
|
||||
} else
|
||||
{
|
||||
|
||||
dstRect = rtRectf(0,0, 44,39);
|
||||
|
||||
}
|
||||
|
||||
dstRect.AdjustPosition(vFinalPos.x, vFinalPos.y);
|
||||
if (IsLargeScreen())
|
||||
{
|
||||
dstRect.AdjustPosition(19, 25);
|
||||
} else
|
||||
{
|
||||
dstRect.AdjustPosition(9, 12);
|
||||
|
||||
}
|
||||
|
||||
|
||||
pSurf->BlitEx(dstRect, srcRect, MAKE_RGBA(255* *m_pAlpha,255* *m_pAlpha,255* *m_pAlpha,255* *m_pAlpha));
|
||||
|
||||
if (g_dglo.GetActiveView() == DinkGlobals::VIEW_ZOOMED)
|
||||
{
|
||||
|
||||
int alpha = int(255.0f * *m_pAlpha);
|
||||
|
||||
if (alpha > 2)
|
||||
{
|
||||
|
||||
|
||||
if (m_mode ==MODE_MAGIC)
|
||||
{
|
||||
float percent = DinkGetMagicChargePercent();
|
||||
|
||||
if (percent > 0)
|
||||
{
|
||||
|
||||
|
||||
//LogMsg("Magic: %.2f", DinkGetMagicChargePercent());
|
||||
rtRectf rBar(0,0, iPhoneMapX2X(54)*percent, iPhoneMapY2X(3));
|
||||
rBar.AdjustPosition(vFinalPos.x, vFinalPos.y);
|
||||
rBar.AdjustPosition(iPhoneMapX2X(6), iPhoneMapY2X(-4));
|
||||
|
||||
if (percent == 1)
|
||||
{
|
||||
DrawFilledRect(rBar, MAKE_RGBA(0, 180, 0, 255* *m_pAlpha));
|
||||
DrawRect(rBar, MAKE_RGBA(0, 255, 0, 255* *m_pAlpha));
|
||||
|
||||
} else
|
||||
{
|
||||
|
||||
DrawFilledRect(rBar, MAKE_RGBA(0, 100, 0, 255* *m_pAlpha));
|
||||
DrawRect(rBar, MAKE_RGBA(0, 255, 0, 170* *m_pAlpha));
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
float percent = DinkGetHealthPercent();
|
||||
//LogMsg("Magic: %.2f", DinkGetMagicChargePercent());
|
||||
rtRectf rBar(0,0, iPhoneMapX2X(54)*percent, iPhoneMapY2X(3));
|
||||
rBar.AdjustPosition(vFinalPos.x, vFinalPos.y);
|
||||
rBar.AdjustPosition(iPhoneMapX2X(6), iPhoneMapY2X(-4));
|
||||
|
||||
DrawFilledRect(rBar, MAKE_RGBA(180, 0, 0, 255* *m_pAlpha));
|
||||
DrawRect(rBar, MAKE_RGBA(255, 0, 0, 255* *m_pAlpha));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActionButtonComponent::OnUpdate(VariantList *pVList)
|
||||
{
|
||||
}
|
||||
|
||||
void ActionButtonComponent::UpdateIcon()
|
||||
{
|
||||
}
|
||||
|
||||
//register ourselves to render if the parent does
|
||||
GetParent()->GetFunction("OnRender")->sig_function.connect(1, boost::bind(&ActionButtonComponent::OnRender, this, _1));
|
||||
GetParent()->GetFunction("OnUpdate")->sig_function.connect(1, boost::bind(&ActionButtonComponent::OnUpdate, this, _1));
|
||||
|
||||
UpdateIcon();
|
||||
}
|
||||
|
||||
void ActionButtonComponent::OnRemove()
|
||||
{
|
||||
EntityComponent::OnRemove();
|
||||
}
|
||||
|
||||
void ActionButtonComponent::OnRender(VariantList *pVList)
|
||||
{
|
||||
CL_Vec2f vFinalPos = pVList->m_variant[0].GetVector2()+*m_pPos2d;
|
||||
|
||||
Surface *pSurf;
|
||||
|
||||
switch (m_mode)
|
||||
{
|
||||
case MODE_MAGIC:
|
||||
pSurf = DinkGetMagicIconImage();
|
||||
break;
|
||||
|
||||
case MODE_WEAPON:
|
||||
pSurf = DinkGetWeaponIconImage();
|
||||
break;
|
||||
}
|
||||
|
||||
if (pSurf)
|
||||
{
|
||||
rtRectf srcRect = pSurf->GetRectf();
|
||||
rtRectf dstRect = srcRect;
|
||||
|
||||
if (IsLargeScreen())
|
||||
{
|
||||
|
||||
dstRect = rtRectf(0,0, 90,90);
|
||||
|
||||
} else
|
||||
{
|
||||
|
||||
dstRect = rtRectf(0,0, 44,39);
|
||||
|
||||
}
|
||||
|
||||
dstRect.AdjustPosition(vFinalPos.x, vFinalPos.y);
|
||||
if (IsLargeScreen())
|
||||
{
|
||||
dstRect.AdjustPosition(19, 25);
|
||||
} else
|
||||
{
|
||||
dstRect.AdjustPosition(9, 12);
|
||||
|
||||
}
|
||||
|
||||
|
||||
pSurf->BlitEx(dstRect, srcRect, MAKE_RGBA(255* *m_pAlpha,255* *m_pAlpha,255* *m_pAlpha,255* *m_pAlpha));
|
||||
|
||||
if (g_dglo.GetActiveView() == DinkGlobals::VIEW_ZOOMED)
|
||||
{
|
||||
|
||||
int alpha = int(255.0f * *m_pAlpha);
|
||||
|
||||
if (alpha > 2)
|
||||
{
|
||||
|
||||
|
||||
if (m_mode ==MODE_MAGIC)
|
||||
{
|
||||
float percent = DinkGetMagicChargePercent();
|
||||
|
||||
if (percent > 0)
|
||||
{
|
||||
|
||||
|
||||
//LogMsg("Magic: %.2f", DinkGetMagicChargePercent());
|
||||
rtRectf rBar(0,0, iPhoneMapX2X(54)*percent, iPhoneMapY2X(3));
|
||||
rBar.AdjustPosition(vFinalPos.x, vFinalPos.y);
|
||||
rBar.AdjustPosition(iPhoneMapX2X(6), iPhoneMapY2X(-4));
|
||||
|
||||
if (percent == 1)
|
||||
{
|
||||
DrawFilledRect(rBar, MAKE_RGBA(0, 180, 0, 255* *m_pAlpha));
|
||||
DrawRect(rBar, MAKE_RGBA(0, 255, 0, 255* *m_pAlpha));
|
||||
|
||||
} else
|
||||
{
|
||||
|
||||
DrawFilledRect(rBar, MAKE_RGBA(0, 100, 0, 255* *m_pAlpha));
|
||||
DrawRect(rBar, MAKE_RGBA(0, 255, 0, 170* *m_pAlpha));
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
float percent = DinkGetHealthPercent();
|
||||
//LogMsg("Magic: %.2f", DinkGetMagicChargePercent());
|
||||
rtRectf rBar(0,0, iPhoneMapX2X(54)*percent, iPhoneMapY2X(3));
|
||||
rBar.AdjustPosition(vFinalPos.x, vFinalPos.y);
|
||||
rBar.AdjustPosition(iPhoneMapX2X(6), iPhoneMapY2X(-4));
|
||||
|
||||
DrawFilledRect(rBar, MAKE_RGBA(180, 0, 0, 255* *m_pAlpha));
|
||||
DrawRect(rBar, MAKE_RGBA(255, 0, 0, 255* *m_pAlpha));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActionButtonComponent::OnUpdate(VariantList *pVList)
|
||||
{
|
||||
}
|
||||
|
||||
void ActionButtonComponent::UpdateIcon()
|
||||
{
|
||||
}
|
||||
|
||||
Entity * CreateActionButtonEntity(Entity *pParentEnt, string name, string fileName, float x, float y)
|
||||
{
|
||||
|
||||
|
|
|
@ -6,11 +6,17 @@
|
|||
|
||||
CursorComponent::CursorComponent()
|
||||
{
|
||||
#ifdef WINAPI
|
||||
ShowCursor(false);
|
||||
#endif
|
||||
SetName("Cursor");
|
||||
}
|
||||
|
||||
CursorComponent::~CursorComponent()
|
||||
{
|
||||
#ifdef WINAPI
|
||||
ShowCursor(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CursorComponent::OnAdd(Entity *pEnt)
|
||||
|
@ -28,6 +34,7 @@ void CursorComponent::OnAdd(Entity *pEnt)
|
|||
GetParent()->GetFunction("OnInput")->sig_function.connect(1, boost::bind(&CursorComponent::OnInput, this, _1));
|
||||
GetParent()->GetParent()->GetFunction("OnKillingControls")->sig_function.connect(1, boost::bind(&CursorComponent::OnKillingControls, this, _1));
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CursorComponent::OnRemove()
|
||||
|
@ -58,30 +65,73 @@ void CursorComponent::OnUpdate(VariantList *pVList)
|
|||
|
||||
void CursorComponent::OnInput( VariantList *pVList )
|
||||
{
|
||||
|
||||
//0 = message type, 1 = parent coordinate offset
|
||||
CL_Vec2f pt = pVList->Get(1).GetVector2();
|
||||
//pt += GetAlignmentOffset(*m_pSize2d, eAlignment(*m_pAlignment));
|
||||
|
||||
switch (eMessageType( int(pVList->Get(0).GetFloat())))
|
||||
|
||||
|
||||
if (IsDesktop())
|
||||
{
|
||||
case MESSAGE_TYPE_GUI_CLICK_START:
|
||||
//HandleClickStart(pt);
|
||||
OnUpdatePos(pt);
|
||||
break;
|
||||
case MESSAGE_TYPE_GUI_CLICK_END:
|
||||
if (!m_bDisable)
|
||||
|
||||
//controls for a real mouse
|
||||
|
||||
switch (eMessageType(int(pVList->Get(0).GetFloat())))
|
||||
{
|
||||
case MESSAGE_TYPE_GUI_CLICK_START:
|
||||
//HandleClickStart(pt);
|
||||
OnUpdatePos(pt);
|
||||
g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true;
|
||||
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case MESSAGE_TYPE_GUI_CLICK_END:
|
||||
if (!m_bDisable)
|
||||
{
|
||||
|
||||
//HandleClickEnd(pt);
|
||||
break;
|
||||
case MESSAGE_TYPE_GUI_CLICK_MOVE:
|
||||
case MESSAGE_TYPE_GUI_CLICK_MOVE_RAW:
|
||||
OnUpdatePos(pt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//HandleClickEnd(pt);
|
||||
break;
|
||||
case MESSAGE_TYPE_GUI_CLICK_MOVE:
|
||||
case MESSAGE_TYPE_GUI_CLICK_MOVE_RAW:
|
||||
OnUpdatePos(pt);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
//controls for a touch screen. Selecting is different
|
||||
|
||||
|
||||
switch (eMessageType(int(pVList->Get(0).GetFloat())))
|
||||
{
|
||||
case MESSAGE_TYPE_GUI_CLICK_START:
|
||||
//HandleClickStart(pt);
|
||||
OnUpdatePos(pt);
|
||||
break;
|
||||
case MESSAGE_TYPE_GUI_CLICK_END:
|
||||
if (!m_bDisable)
|
||||
{
|
||||
OnUpdatePos(pt);
|
||||
g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true;
|
||||
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true;
|
||||
}
|
||||
|
||||
//HandleClickEnd(pt);
|
||||
break;
|
||||
case MESSAGE_TYPE_GUI_CLICK_MOVE:
|
||||
case MESSAGE_TYPE_GUI_CLICK_MOVE_RAW:
|
||||
OnUpdatePos(pt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue