Jump to content




[API] Mouse and graphic api V1.6.1 beta. Easy to use GUI API with full mouse support

api utility media

108 replies to this topic

#1 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 24 November 2012 - 06:21 AM

Hello everyone !

Warning : if you enter wrong args type for pop-up, it will skip the drawing of the pop-up to avoid crash

Introducing my easy to use GUI API.
It's a medium-advanced API wich mean that it allow you to do things very easily but with less personnalisation than a basic API. It's principally designed for debutant in Lua who want to create a GUI without complicated code.

I will add features as long as I got idea so if you have a request, ask for it ! Sadly, i can code more than I can test it so if you want to help, test it for me ! Thanks ;)

Obviously, I let you use and modify this code, but please don't redistribute it as your own. Link to this page or at least credit me in case of you wanted to make an installer. Please just let me know ! Thanks you by advance.

Functions :
Spoiler

Download :
Spoiler

Planned features :
Spoiler

Changelog :
Spoiler

Example and screenshoots : (a bit old)
Spoiler

Any feedback and suggestions are welcome !

#2 billysback

  • Members
  • 569 posts

Posted 24 November 2012 - 06:26 AM

No download, has no code.

#3 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 24 November 2012 - 06:31 AM

View Postbillysback, on 24 November 2012 - 06:26 AM, said:

No download, has no code.
Fixed, I do not think there will be a response as fast as that !

#4 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 25 November 2012 - 10:22 AM

Beta 1.2 out ! Download it to fix buttonClick() and buttonWaitClick() functions ! Please tell me if it work. Edit : just tested, it doesn't work ...

#5 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 27 November 2012 - 06:03 AM

Again fix it, this time it work ! Report any bug you find !

#6 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 28 November 2012 - 06:02 AM

Version 1.2 released ! Fully fonctionnal, even if the popUp() function still didn't clear itself after being clicked. Will be fixed in the next release.

#7 Zudo

  • Members
  • 800 posts
  • LocationUK

Posted 28 November 2012 - 06:59 AM

Comeon and fix the popup glitch! THIS IS EPIC!

#8 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 28 November 2012 - 07:19 AM

View PostZudoHackz, on 28 November 2012 - 06:59 AM, said:

Comeon and fix the popup glitch! THIS IS EPIC!
Thanks you a lot ! :) As say in the first post, i'm working on it but it will be hard to make it redraw things behind the pop-up because I don't know how to save what is displaying on the screen...

#9 ArchAngel075

  • Members
  • 149 posts

Posted 29 November 2012 - 11:06 AM

create a buffer table i guess, im not sure how to do this but to save onscreen data make it save the current data to a buffer and then popup, once popup is gone make it rerender the saved screen buffer?

Sorry i cant give advice, although i like this program and may use it for a minigame i plan on making :) (especially because of the waitforclick() )

#10 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 29 November 2012 - 07:13 PM

View PostArchAngel075, on 29 November 2012 - 11:06 AM, said:

create a buffer table i guess, im not sure how to do this but to save onscreen data make it save the current data to a buffer and then popup, once popup is gone make it rerender the saved screen buffer?

Sorry i cant give advice, although i like this program and may use it for a minigame i plan on making :) (especially because of the waitforclick() )
Thanks you :) I have got the idea of the buffer by looking on the graphic API by killavanilla but as I don't want to copy it, I don't know how to make for multiple call of the same function ...
ps: I have done this function and wanted to released it but as there would be only 30 lines I got the idea to add graphic function ^^.

#11 Oct125

  • Members
  • 49 posts

Posted 01 December 2012 - 06:50 AM

Epic! I will use it on my program! If possible, add a option to select the color of the button,i tested the non-beta.

#12 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 01 December 2012 - 06:54 AM

View PostOct125, on 01 December 2012 - 06:50 AM, said:

Epic! I will use it on my program! If possible, add a option to select the color of the button,i tested the non-beta.
Thanks you ! I'm implementing the color selection on all the draw function ;) Added in beta version !! :)

#13 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 04 December 2012 - 06:01 AM

V1.3 released ! Add a buffer, colours customisation and fix the pop-up glitch !

#14 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 08 December 2012 - 11:35 PM

V1.4 released ! Rewrite the way the API work. Doesn't change too much for you. Added the getSelection() and cPopUp()

#15 ArchAngel075

  • Members
  • 149 posts

Posted 09 December 2012 - 06:34 AM

Nice update, i can perhaps use this in Angel-TV now but a few questions :

gui.setButton(x, y, a, b, text, colorLine, colorBackground)
-What does the a and b arguments control ?

gui.getSelection() Take all the drawn buttons with the set function, not the draw one, and return the one which has been clicked.
-Used with set function, what exactly does it return ? the cords? button name?

-Can I set Buttons WITHIN a popup? ie, provide a "Are you sure" and then options "yes" "No" "Cancel"...
--A popup with a single input is abit useless unless its a "XYZ has happened, press OK to continue" or similar...

Plus :
Above Ive highlighted some grammar or spelling mistakes that could maybe be fixed if you feel so, they have been colored red..

#16 ArchAngel075

  • Members
  • 149 posts

Posted 09 December 2012 - 07:05 AM

Sorry for this double posting but :

Suggestions :
for
setButton(x, y, a, b, text, colorLine, color)
and
setButtonc(x, y, a, b, text, colorLine, color)

perhaps you can combine them into
setButton(clears,x, y, a, b, text, colorLine, color)

the function will then be :
if clears == 1 or true then --take your pick if you wish to use 1,0 or true,false for this..
term.clear()
end
if colorLine then
colorL = colorLine
else
colorL = colors.white
end
if color then
colorB = color
else
colorB = colors.black
end
table.insert(runButton, x)
table.insert(runButton, y)
table.insert(runButton, a)
table.insert(runButton, B)/>/>
table.insert(runButton, text)
table.insert(runButton, colorL)
table.insert(runButton, colorB)
table.insert(coordButton, x)
table.insert(coordButton, y)
table.insert(coordButton, a)
table.insert(coordButton, B)/>/>
end
-----
Also for clearing the buffer for
gui.render()
you can use
gui.render(s)
and check 's' for true or 1 or nil for whether it resets or not and do as needed...

#17 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 09 December 2012 - 08:34 AM

View PostArchAngel075, on 09 December 2012 - 07:05 AM, said:

Sorry for this double posting but :

Suggestions :
for
setButton(x, y, a, b, text, colorLine, color)
and
setButtonc(x, y, a, b, text, colorLine, color)

perhaps you can combine them into
setButton(clears,x, y, a, b, text, colorLine, color)

the function will then be :
if clears == 1 or true then --take your pick if you wish to use 1,0 or true,false for this..
term.clear()
end
if colorLine then
colorL = colorLine
else
colorL = colors.white
end
if color then
colorB = color
else
colorB = colors.black
end
table.insert(runButton, x)
table.insert(runButton, y)
table.insert(runButton, a)
table.insert(runButton, B)/>/>/>
table.insert(runButton, text)
table.insert(runButton, colorL)
table.insert(runButton, colorB)
table.insert(coordButton, x)
table.insert(coordButton, y)
table.insert(coordButton, a)
table.insert(coordButton, B)/>/>/>
end
-----
Also for clearing the buffer for
gui.render()
you can use
gui.render(s)
and check 's' for true or 1 or nil for whether it resets or not and do as needed...
Thanks you a lot for the suggestion for the combination of functions, I will change to that. Also thanks for tye grammar corrections, as I'm french and only 15, I don't know everything of the english grammar :). I updated the OP to make things more clear about the arguments.
For the moment you have to manually draw the button within the pop-up but I will add that, sounds cool :P I think I will need to make the pop-up bigger for that. I will code it today, and test it tomorrow but the beta version will be available tonight.

#18 ArchAngel075

  • Members
  • 149 posts

Posted 09 December 2012 - 09:53 AM

Why not make the popup auto resize based on the options given? My API will lengthen its "box" size to stretch using the longest options string + 5. just track the "last greatest string length" for that popup?

#19 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 10 December 2012 - 09:14 AM

View PostArchAngel075, on 09 December 2012 - 09:53 AM, said:

Why not make the popup auto resize based on the options given? My API will lengthen its "box" size to stretch using the longest options string + 5. just track the "last greatest string length" for that popup?
I'm rewriting the pop-up to make it work this way :)

#20 ArchAngel075

  • Members
  • 149 posts

Posted 12 December 2012 - 06:10 AM

will wait for that update since those popups will be amazing to use for all the "yes, no" questions in my AngelTV :P





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users