#nuvie@irc.freenode.net logs for 13 Sep 2013 (GMT)

Archive Today Yesterday Tomorrow
Nuvie homepage


[11:51:43] --> TheCycoONE has joined #nuvie
[15:47:28] --> Malignant_Manor has joined #nuvie
[15:48:27] <Malignant_Manor> Eric hasn't been in chat for a month.
[15:49:08] <Malignant_Manor> I've procrastinated on menus in Nuvie for almost a year and 3 months.
[16:55:29] <Malignant_Manor> wjp: , SugarCube , would either of you be willing to code text buttons that can toggle like Exult's menu buttons?
[17:44:15] <wjp> hmm
[17:44:40] <wjp> what do you need exactly?
[17:45:59] <wjp> the 'combat strategy' button in the inventory window already seems to do something like that, for example
[17:47:24] <Malignant_Manor> I think that just prints text over the existing gump button.
[17:47:40] <wjp> eew
[17:49:16] <Malignant_Manor> I think Exult had text buttons that took string indexes
[17:49:43] <Malignant_Manor> I don't remember if they returned a string or the index number offhand.
[17:50:11] <Malignant_Manor> I did that text over the combat strategy button in Nuvie.
[17:54:08] <Malignant_Manor> It seems to return the index.
[17:55:42] <wjp> does it need to have both an image and text?
[17:56:33] <Malignant_Manor> The game has text buttons like the yes and no buttons when you quit.
[17:57:10] <Malignant_Manor> It would be like those but with indexes that returned their state.
[17:57:56] <wjp> I think the easiest approach is to make a subclass of GUI_Button that overrides MouseUp to change text
[17:58:34] <wjp> with an appropriate constructor and a function to get the current index
[18:02:11] <wjp> I can probably do a quick version of that if you're willing to test and debug it
[18:02:42] <Malignant_Manor> That would be nice. I don't really know where to start offhand.
[18:03:03] <wjp> any suggestion for a name of the class?
[18:03:29] <Malignant_Manor> I'm horrible at that. GUI_Toggle_Button?
[18:03:51] <Malignant_Manor> GUI_Text_Toggle_Button?
[18:04:09] <wjp> works for me
[18:04:41] <wjp> heh, this GUI code is apparently from SDL example code
[18:05:42] <Malignant_Manor> Yeah, I remember that from when I messed with allowing single clicking and double clicking to work simultaneously.
[18:07:16] <wjp> so, I'm already stuck at figuring out the right copyright/license header to use ;-)
[18:08:28] <Malignant_Manor> That's another thing I'm bad at.
[18:08:57] * wjp is improvising
[18:10:02] <Malignant_Manor> Option menus are long overdue. There's a ton of cfg settings now.
[18:14:19] <wjp> hm, is nuvie more of an C++/STL project or a C-style data project?
[18:14:44] <wjp> in particular, should the list of options be a std::vector<std::string> or a const char* const*?
[18:14:56] <wjp> probably the latter?
[18:16:11] <Malignant_Manor> I'm not good to answer that. There is a lot of c-style but I'm not sure how things are overall.
[18:16:52] <Malignant_Manor> There is no coding standard in Nuvie.
[18:17:44] * wjp will continue improvising :-)
[18:18:48] <Malignant_Manor> Nuvie is a bit of a kludge.
[18:19:35] <Malignant_Manor> I think most open source projects with multiple developers that don't set ridged standards are.
[18:50:40] <wjp> ok, this _might_ work
[18:52:17] <wjp> http://www.usecode.org/nuvie/
[18:53:08] <wjp> Malignant_Manor: it compiles for me, but it's completely untried and untested
[18:55:31] <wjp> oh, oversight #1 spotted. Reload if you had already downloaded them
[18:57:05] <Malignant_Manor> I was wondering about the data part.
[18:57:48] <Malignant_Manor> Looks like the same as button though.
[18:58:57] <wjp> data is an opaque thing. You just get back what you put in there
[18:59:04] <wjp> (in callbacks)
[18:59:38] <Malignant_Manor> const char* const*
[18:59:55] <wjp> yes
[19:00:23] <wjp> a const array of pointers to const char data
[19:01:41] <wjp> it's the type a static array like { "some", "random", "text" } would have
[19:06:18] <Malignant_Manor> const char* const* test = { "some", "random", "text" };
[19:06:31] <Malignant_Manor> error: scalar object 'test' requires one element in initializer
[19:08:59] <wjp> const char* const test[] = { "some", "random", "text" };
[19:13:17] <Malignant_Manor> That worked. You didn't initialize count before the assert. The text button toggles.
[19:15:48] <Malignant_Manor> Nuvie will crash if the count_ is larger than the array.
[19:16:36] <Malignant_Manor> (which users should never see anyway)
[19:23:02] <Malignant_Manor> That seems to work.
[19:25:56] <Malignant_Manor> Here's a svn patch. http://pastebin.com/Kpxg7xLb
[19:26:34] <Malignant_Manor> It has makefile.common changes and the count = count_; line moved before the assert.
[19:27:18] <Malignant_Manor> Thanks, you should be able to make a changelog entry and commit.
[19:27:56] <Malignant_Manor> I haven't tested callback but I don't think I need it.
[19:30:09] <Malignant_Manor> I don't know if you can add an assert to test if count_ == texts_ 's array size (or <=)
[19:30:52] <wjp> you can't
[19:31:38] <wjp> committed
[19:31:51] <Malignant_Manor> Well, the crash is pretty obvious anyway.
[19:32:48] <wjp> anyway, enjoy :-)
[19:42:46] * Dominus hates mail.app in OS X preview... it chockes and doesn't show me new mail without applying some tricks again and again and again...
[19:44:57] <Dominus> new snapshot compiled fine and uploaded
[19:45:24] <Malignant_Manor> New snapshot that does nothing new.
[19:45:59] <wjp> always good to know it builds though :-)
[19:46:06] <Malignant_Manor> Yeah
[19:46:41] <Dominus> Malignant_Manor: I know, but as wjp said, and besides my system is set to do it automatically anyway (once mail actually arrives :))
[19:47:06] <Malignant_Manor> Now I need to figure out a nice way to lock input so you can't move (and other things) when using the menus.
[19:49:09] <Dominus> can't you rip this from Exult?
[19:49:48] <Dominus> as Exult gives the option to pause or leave the game running with menus open that could be a starting point to get the code...
[19:50:49] <Malignant_Manor> I think Exult handles gui stuff a lot differently.
[19:56:26] * Dominus shrugs
[19:56:40] <Dominus> could be, you know I'm way worse than you with code... :)
[20:06:15] <Malignant_Manor> The game window you play in is considered a gui and so are the inventory screen, etc. that are always displayed. You need to select a specific gui to lock input to. If you allow reverting back to the main menu, the main menu needs locked back again.
[20:06:47] <Malignant_Manor> There are shortcuts to several of the sub menus which could pose issues.
[21:09:21] <-- Malignant_Manor has left IRC (Quit: ChatZilla 0.9.90.1 [Firefox 23.0.1/20130814063812])
[21:24:51] <-- TheCycoONE has left IRC (Quit: And then there were n-1)