From 45b570b6f7c24c16a03da3a63542a679b47821f4 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Wed, 7 Oct 2015 10:53:11 +0800 Subject: [PATCH] border highlighter --- projects/mtg/src/CardGui.cpp | 53 ++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index 0851fa42e..28628774f 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -260,6 +260,47 @@ void CardGui::Render() fakeborder->SetColor(ARGB((int)(actA),15,15,15)); renderer->RenderQuad(fakeborder.get(), actX, actY, actT, (29 * actZ + 1) / 16, 42 * actZ / 16); } + //draw border for highlighting + if (card && card->isTargetted()) + { + if(card->isTapped()) + { + //focus? + CardView* cv = dynamic_cast(card->view); + if(cv->mHasFocus) + { + renderer->FillRoundRect(actX - (scale * quad->mWidth / 2)-10,actY - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(95,255,0,0)); + } + else + { + renderer->FillRoundRect(actX - (scale * quad->mWidth / 2)-8,actY - (scale * quad->mHeight / 2)+4, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(95,255,0,0)); + } + } + else + { + renderer->FillRoundRect(actX - (scale * quad->mWidth / 2)-2,actY - (scale * quad->mHeight / 2)-2, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 1.8f,ARGB(95,255,0,0)); + } + } + if (card && card->isTargetter()) + { + if(card->isTapped()) + { + //focus? + CardView* cv = dynamic_cast(card->view); + if(cv->mHasFocus) + { + renderer->FillRoundRect(actX - (scale * quad->mWidth / 2)-10,actY - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(95,0,245,0)); + } + else + { + renderer->FillRoundRect(actX - (scale * quad->mWidth / 2)-8,actY - (scale * quad->mHeight / 2)+4, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(95,0,245,0)); + } + } + else + { + renderer->FillRoundRect(actX - (scale * quad->mWidth / 2)-2,actY - (scale * quad->mHeight / 2)-2, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 1.8f,ARGB(95,0,245,0)); + } + } //draw the card image renderer->RenderQuad(quad.get(), actX, actY, actT, scale, scale); } @@ -301,7 +342,7 @@ void CardGui::Render() } } - //draw border?line + //draw line if (card && card->isTargetted()) { if(card->isTapped()) @@ -309,9 +350,13 @@ void CardGui::Render() //focus? CardView* cv = dynamic_cast(card->view); if(cv->mHasFocus) + { renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-10,actY - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,255,0,0)); + } else + { renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-8,actY - (scale * quad->mHeight / 2)+4, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,255,0,0)); + } } else { @@ -320,14 +365,18 @@ void CardGui::Render() } if (card && card->isTargetter()) { - if(card->isTapped()) + if(card->isTapped()) { //focus? CardView* cv = dynamic_cast(card->view); if(cv->mHasFocus) + { renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-10,actY - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,0,255,0)); + } else + { renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-8,actY - (scale * quad->mHeight / 2)+4, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,0,255,0)); + } } else {