Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 10th Aug 2016 00:13 Edited at: 10th Aug 2016 12:11


Ok I mentioned earlier that I had tried to code a menu editor within th main level editor of mine, it got messy so decided to rip out the code I had and develop it separately.
You can use this for whatever, I am about to integrate it back into my main level editor and thought I would share it before it vanishes!

I have finished it and hopefully bug free, here is some info on its usage.

First thing you will probably notice is a green box, this represents where you want to paste a button, go ahead, left click wherever and a button is created! You will notice a text gets created along with the button, this is to keep track of the button ID as we will be deleting/re-using them!


Once you have put down a button, and maybe decided you dont want it there, or atall, you can click on the button, which makes it turn red, then press delete to delete it. You can do this on multiple buttons for multiple select/delete, clicking again deselects the button(s)



Right, now let us change the way our button is created, the edit boxes at the bottom!

First up from left to right is
B-Alpha: kinda speaks for itself and sets the alpha of the button to be created, a value of 0-255 here!
FN: means filename, the default being default.dat, you can put anything in here, creating multiple files!
BS: means button size, defaults to 80
BN is the name you want to give the button, defaults to 'Button'
the last 3 boxes, BB, BG and BR are for setting the RGB values of the button colour respectively.


All keys are tied to the function keys for obvious reasons! these are:

F1- loads a saved file by the file name in its edit box
F4 - saves the file again by file name given

F8 clears the whole level.
F7 loads in a background image you select.

F5 hides/shows all the text and edit boxes


An example of its usage:

I just went with the defaults here, saved the file,created a new projects and copied the following code from the editor:


2 functions, the load and clear! plus the type and array definitions the constant and a few needed globals!
I finally copy the file that was saved in %appdata% from the menu maker App in my case, to the new projects media folder,along with any images I may have chosen.

The neat way about this is that I can have multiple files per project,simply call load_layout(id$) to load it in. Call clear_layout() to totally clear the current menu at any point.

I might develop this more to allow for images on the buttons, but I dunno!
**edit sorry missed the code to read the file name in the first piece,I have put it in now!
There is probably a few fields in the button type that are defunct but I kept them in just in case they become handy later!
Hail to the king, baby!
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 10th Aug 2016 10:52 Edited at: 10th Aug 2016 12:12
There was really no need for the count array so I have removed this and used a field I had defined in the button type for deleting them.
Code has been changed. Let me know if you find problems. I will keep testing it and update the code as needed,if needed!
Done some more fixing in the main menu editor code, wasnt resetting a few fields after clearing!
Hail to the king, baby!

Login to post a reply

Server time is: 2024-11-24 19:16:37
Your offset time is: 2024-11-24 19:16:37