Erwan
- It is now possible to have avatars associated to each Deck - Added SFX - Added Music files - Possibility to choose your opponent - Opponents' difficulty is measured according to their number of victories against a given deck
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#include "../include/SimpleMenu.h"
|
||||
#include "../include/SimpleMenuItem.h"
|
||||
|
||||
SimpleMenu::SimpleMenu(int id, JGuiListener* listener, JLBFont* font, int x, int y, int width, const char * _title): JGuiController(id, listener){
|
||||
SimpleMenu::SimpleMenu(int id, JGuiListener* listener, JLBFont* font, int x, int y, int width, const char * _title, int _maxItems): JGuiController(id, listener){
|
||||
mHeight = 0;
|
||||
mWidth = width;
|
||||
mX = x;
|
||||
@@ -15,6 +15,8 @@ SimpleMenu::SimpleMenu(int id, JGuiListener* listener, JLBFont* font, int x, int
|
||||
}else{
|
||||
displaytitle = 0;
|
||||
}
|
||||
startId = 0;
|
||||
maxItems = _maxItems;
|
||||
}
|
||||
|
||||
void SimpleMenu::Render(){
|
||||
@@ -25,10 +27,24 @@ void SimpleMenu::Render(){
|
||||
renderer->FillRoundRect(mX+2,mY+2,mWidth - 4,mHeight-4,10,ARGB(255,62,62,62));
|
||||
if (displaytitle)
|
||||
mFont->DrawString(title.c_str(), mX+10, mY+10);
|
||||
JGuiController::Render();
|
||||
for (int i = startId; i < startId + maxItems ; i++){
|
||||
if (i > mCount-1) break;
|
||||
((SimpleMenuItem * )mObjects[i])->RenderWithOffset(-20*startId);
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleMenu::Update(float dt){
|
||||
JGuiController::Update(dt);
|
||||
if (mCurr > startId + maxItems-1){
|
||||
startId = mCurr - maxItems +1;
|
||||
}else if (mCurr < startId){
|
||||
startId = mCurr;
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleMenu::Add(int id, const char * text){
|
||||
JGuiController::Add(NEW SimpleMenuItem(id, mFont, text, mWidth/2 + mX + 10, mY + 10 + mHeight, (mCount == 0)));
|
||||
mHeight += 20;
|
||||
int y = mCount*20;
|
||||
if (displaytitle) y+=20;
|
||||
JGuiController::Add(NEW SimpleMenuItem(id, mFont, text, mWidth/2 + mX + 10, mY + 10 + y, (mCount == 0)));
|
||||
if (mCount <= maxItems) mHeight += 20;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user