Forums » Extensions and Tools » Slider Menu Grid »
| Vitaly Shumakov | Slider Menu Grid | ||||
|---|---|---|---|---|---|
|
Added by Vitaly Shumakov about 1 year ago
Hello! SlidingMenu.zip (3.4 kB) SlidigMenu.zip (3.8 kB) |
||||
| Emmy Chen | RE: Slider Menu Grid | ||||
|
Added by Emmy Chen about 1 year ago
wow. this is what I am looking for. got to try it out. thanks |
||||
| Vitaly Shumakov | RE: Slider Menu Grid | ||||
|
Added by Vitaly Shumakov about 1 year ago
I hope you find useful, Emmy New version! I corrected some errors and changed the logic of adding elements of the array. The first items are added to the first page SlidingMenu(v1.01).zip (3.8 kB) |
||||
| Emmy Chen | RE: Slider Menu Grid | ||||
|
Added by Emmy Chen about 1 year ago
Hi Vitaly Shumakov: I tried Slider Menu Grid. It works very well. Thank you very much providing this wonderful code. I am wondering can you make it as a loop? if I slide menu to the last page if I continue slide the page , can you make it go to first page. same as the first page, if I continue slide the screen, can you make it go to the last page? Thanks again Emmy |
||||
| Vitaly Shumakov | RE: Slider Menu Grid | ||||
|
Added by Vitaly Shumakov about 1 year ago
The fact is that at the moment, the transition is carried out using the following code: If you simply navigate around the pages, then this code will scroll through all the pages are located between the first and last pages. To loop, I need to change the whole scheme of this piece of software. Of course, I think, but nothing yet I promise. |
||||
| K pop | RE: Slider Menu Grid | ||||
|
Added by K pop about 1 year ago
i fixed it void SlidingMenuGrid::buildGrid(int cols, int rows)
{
}
1 2 3 4 5 11 12 13 14 15 21 22 in previous code iPageCount is 2 (must be 3) so i fix this bug have nice day |
||||
| Vitaly Shumakov | RE: Slider Menu Grid | ||||
|
Added by Vitaly Shumakov about 1 year ago
Fixed a bug where a locked item indicated by the touch as the chosen. SlidingMenu (v1.2).zip - Fix a bugs (4 kB) |
||||
| Emmy Chen | RE: Slider Menu Grid | ||||
|
Added by Emmy Chen about 1 year ago
Thanks for the bug fixing. Good job. I had to work around with this bug. I am so happy that it got fixed. |
||||
| Vitaly Shumakov | RE: Slider Menu Grid | ||||
|
Added by Vitaly Shumakov about 1 year ago
Excellent, Emmy |
||||
| Paulo Coutinho | RE: Slider Menu Grid | ||||
|
Added by Paulo Coutinho 12 months ago
Hi, How to use it? |
||||
| Chris Harback | RE: Slider Menu Grid | ||||
|
Added by Chris Harback 11 months ago
I was super excited to see this class out here, since I think it is pretty close in function to Cocos2d-extension-iPhone's CCScrollLayer. Thanks Vitaly Shumakov for writing it! Sadly, it looks like I'm going to have to adjust for the changes in the latest build of Cocos2d-x 2.0 (no more CCMutableArray, etc.). Has anybody started on such an adjustment? I had thought at first it would be pretty straightforward but as I've gone on with it it looks more complicated than I had expected. |
||||
| Paulo Coutinho | RE: Slider Menu Grid | ||||
|
Added by Paulo Coutinho 11 months ago
Already have SliderMenu converted to Cocos2d-2.0: |
||||
| Chris Harback | RE: Slider Menu Grid | ||||
|
Added by Chris Harback 11 months ago
Paulo Coutinho wrote:
Incredible! Thanks Paulo Coutinho! |
||||
| Dean Nahaul | RE: Slider Menu Grid | ||||
|
Added by Dean Nahaul 8 months ago
Hi all, I'm trying to use this sliding menu for my game and everything is working great. The only problem is that i cannot let the program know which button in the grid has been pressed. e.g If level 4 has been selected i'd like a function to return the value 4. I'm trying to use the getTag() function but it always seems to return "-1" Any suggestions? @void LevelMenu::menuLevels(CCObject* pSender)
{
}@ |
||||
| Vitaly Shumakov | RE: Slider Menu Grid | ||||
|
Added by Vitaly Shumakov 8 months ago
Hi Dean! |
||||
| Dean Nahaul | RE: Slider Menu Grid | ||||
|
Added by Dean Nahaul 8 months ago
Thank you very much for the quick reply Vitaly, it's worked a treat! |
||||
| Emilio Exposito | RE: Slider Menu Grid | ||||
|
Added by Emilio Exposito 6 months ago
Hi, Has someone used this sliding menu in cocos2d-2.0-x-2.0.4? I was able to show in the screen, it slides between pages but when a menu item is clicked the callback function is not called. I was debugging the code and I found that the "error" (I do not know if it is an error or something that I am not doing right) is in SlidingMenuGrid::GetItemWithinTouch method, the local ccpoint and the rect generated do not match... Do you have also this error? Thank you for your answers!!! |
||||
| Paulo Coutinho | RE: Slider Menu Grid | ||||
|
Added by Paulo Coutinho about 1 month ago
Hi, I need it to last cocos2d-x version, anyone have it working with last version? Thanks. |
||||
| Petr Chavik | RE: Slider Menu Grid | ||||
|
Added by Petr Chavik 22 days ago
I updated the code to work on 2.0 (2.0.3), and I also added the option to set threshold in the constructor. SlidingMenu.zip (4.9 kB) |
||||
| Joe Merhej | RE: Slider Menu Grid | ||||
|
Added by Joe Merhej 19 days ago
Thanks for this class! very useful! Is this integrated in cocos2dx now or not? -Copy |
||||
| Kamil Charubin | RE: Slider Menu Grid | ||||
|
Added by Kamil Charubin 17 days ago
Example code, assets from HelloWorld cocos2dx project, put it in your scene HelloWorld constructor or logic init function.
CCArray* menuArray = CCArray::createWithCapacity(24);
CCSize windowSize = CCDirector::sharedDirector()->getOpenGLView()->getDesignResolutionSize();
float w= 0;
float h=0;
for (int i = 0;i<24;i++)
{
CCSprite* spr = CCSprite::create("CloseNormal.png");
CCSprite* selspr = CCSprite::create("CloseSelected.png");
CCSprite* dis = CCSprite::create(""CloseSelected.png");
CCMenuItemSprite* itmspr = CCMenuItemSprite::create(spr, selspr,dis, this, menu_selector(HelloWorld::menuItemCallback));
itmspr->setTag(i);
if (i > 3) itmspr->setEnabled(false);
CCLOG ("tag for item %d" , itmspr->getTag());
menuArray->addObject(itmspr);
}
int row = 3;
int col = 4;
CCPoint p = ccp(80,80);
//some trick to center menu
float eWidth = (col-1)*(w+p.x);
float eHeight = (row-1)*(h+p.y);
CCPoint menuPosition = ccp(
windowSize.width/2.0f -eWidth/2.0f ,
windowSize.height/2.0f -eHeight/2.0f
);
SlidingMenuGrid* sliderMenu = SlidingMenuGrid::menuWithArray(
menuArray,
col,
row,
menuPosition,
p
);
sliderMenu->setAnchorPoint(ccp(0.5, 0.5));
// sliderMenu->setPosition(100,100);
this->addChild(sliderMenu);
Here goes the menu selector function:
void HelloWorld::menuItemCallback(CCObject* pSender)
{
CCLOG ("Item CLICKED: %d", ((CCMenuItemSprite*)pSender)->getTag());
}
|
||||
| Joe Merhej | RE: Slider Menu Grid | ||||
|
Added by Joe Merhej about 15 hours ago
Thanks! -Copy |
||||
| Kamil Charubin | RE: Slider Menu Grid | ||||
|
Added by Kamil Charubin about 13 hours ago
Joe Merhej wrote:
This menu was a part of bigger tab menu. Tab menu wes created dynamically and sometimes i had to slightly tighten items to change position, so I calculeted w and h corrections. |
(1-22/22)


