Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - archentity

Pages: [1]
1
SFML projects / JRPG Style Text Menu by archentity Version 2.0!
« on: May 07, 2014, 11:42:35 pm »
I have finally completed a better version of my original RPG text menu class from here:

http://en.sfml-dev.org/forums/index.php?topic=14322.msg100828#msg100828.

I really ended up not liking how that menu class worked, too much unnecessary stuff had to be managed by the menu. Then I realized that my implementation and way of thinking in regards to designing the menu were incorrect. I was trying to make the menu contain and manage the options that go into it when what a menu should really be doing is simply containing a copy of a list of something else and showing them to the user. Here are a couple of new features that have been added to this menu class that the previous one did not have.

- Support for text objects that display each menu option's quantity, for if there are duplicates of an option in the menu like in the case of rpg inventory menus where a character can have several of the same item at once.

- Better border support: the old menu could only have a plain square border around its edges. This new menu now only has support for using sprites for the border's corners and edges. This class also allows you to make the borders resize themselves along the edges as needed depending on the size of the menu automatically.

Basically the menu works by taking on a deque or vector of strings, quantifies any duplicate strings into a single option with its own variable for its quantity, and then shows it to the screen through its draw function. Reading through the function declarations in the Menu.h file should make using it pretty easy. But if you have any questions, reply to this post or email me at archentitykalim@gmail.com.



2
SFML projects / RPG Style Simple Text Menu
« on: February 04, 2014, 11:18:17 pm »
Looking for a simple text menu like the ones in 2D Final Fantasy games to put into your SFML game??

I have been looking around for a very simple, easy to use rpg style text menu that C++ beginners will have no problem understanding. For some reason it appears no one makes these using SFML or this is such a noob thing that advanced programmers don't even give it a second thought, let alone make a class for it. So this is what I did.

Warning: I am a noob, so keep this in mind. I've spent weeks trying to make this class work and I have also sent every function through rigorous testing so there shouldn't be any problems with the code. The code is also heavily littered with comments and the functions have self explanatory names.

The menu class's declarations (Menu.h) and its definitions (Menu.cpp) are attached to this post. When using these make sure you have the header files that the class asks for.


A brief explanation of how it works

Basically the menu consists of 4 main things:

- a container deque (basically an array that can change size while the program is running like vectors can except they are slightly different) that holds every option in the menu.

- another container deque that holds a list of pointers that only point to the options that are supposed to be drawn to the screen.

- an sf::Rectangle object that works as the background for the menu

- an sf::Rectangle object that works as the border for the menu



I think most of it should be easy to figure out how to use, especially with the comments. BUT if anyone has any questions, problems, or bug reports, just send make a reply to this post or send me an email at www.archentitykalim@gmail.com to let me know. I'm kinda busy right now but I will eventually make a full on tutorial for this if need be.


UPDATE!!! ATTACHMENT FILES HAVE ALSO BEEN UPDATED SO RE-DOWNLOAD THOSE IF YOU ALREADY DOWNLOADED THEM!!!

I added some extra functions to the class that you probably won't have to use but they are there just in case. These functions are:

- int getCurrentOption(); --- Returns the number of the current option.

- std::string getCurrentOptionString(); --- Returns the text string of the current option.

- std::string getFirstOptionString(); --- Returns the text string of the first option.

- int getLastOption(); --- Returns the number of the last option.

- std::string getLastOptionString(); --- Returns the text string of the last option.

- std::string getOptionString(int number); --- Returns the string of the chosen option.






 

Pages: [1]