Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- // This is a globally known value
- // we want to substract the "next" button from max items.
- const int max_items = 32-1;
- void ShowPage(int page, vector<int> const & items)
- {
- int count = 0; // added items count
- for (int i = page*max_items; i < items.size(); ++i) // go through all items, we want to start from page beginning
- {
- cout << "Item number: " << i << endl;
- ++count; // added an item, increase count of items
- if (count >= max_items)
- {
- // we are at limit, add next button and stop adding items
- cout << "Next page" << endl;
- break;
- }
- }
- // Send menu()
- }
- int main() {
- /*
- Through for loops and such you have gathered all items the player has in a list called "items".
- These items can be for example pointers to the items you get from GetItemByPos or similar.
- These are all the valid items to be shown in the menu.
- */
- vector<int> items = {};
- for (int i = 0; i < 100; ++i)
- items.push_back(i);
- ShowPage(0, items);
- ShowPage(1, items);
- ShowPage(100, items);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement