[API] Mouse and graphic api V1.6.1 beta. Easy to use GUI API with full mouse support
#21
Posted 12 December 2012 - 06:49 AM
#22
Posted 13 December 2012 - 04:06 AM
--Edit!!
On line 161 "the bottom line" isn't commented! Beta version!
Testing the Non-beta
#23
Posted 13 December 2012 - 04:21 AM
#24
Posted 13 December 2012 - 05:09 AM
bjornir90, on 13 December 2012 - 04:21 AM, said:
Now i'm using the non-beta (1.4, i think) and it's working fine!
--Edit!
I tested the popUp function but didn't work... So i opened the code and i saw that your: gui.popUp(title, text, x, y, colorLine, colorBackground) function in this post, don't match to the code ( the "x", "y", and "colorLine")... Then i try to fix it and i got this: (Ignoring the popUp position...)
function popUp(title, text, colorLine, color)
And appears to work
1.4 Version!
But... I'm having problems with multi line in the popUp... Any tip?
#25
#26
Posted 13 December 2012 - 06:11 AM
bjornir90, on 13 December 2012 - 05:34 AM, said:
Just to know... I'm using the correct code to check if the button is clicked?
Check the code:
term.setTextColor(colors.white)
gui.drawButton(2, 6, 32, 8, "1", colors.gray)
while true do
btn3 = gui.buttonClick(2, 6, 32, 8)
if btn3 == "true" then -- Press the button
term.setCursorPos(1,19)
term.setTextColor(colors.lime)
print("Ok!")
sleep(2)
end
end
Using this code, i have to press the button many times... Any tip??
#27
Posted 13 December 2012 - 07:05 AM
#28
Posted 13 December 2012 - 10:32 AM
bjornir90, on 13 December 2012 - 07:05 AM, said:
#29
Posted 13 December 2012 - 07:06 PM
Oct125, on 13 December 2012 - 10:32 AM, said:
#30
Posted 13 December 2012 - 11:29 PM
Pages Hook, it takes the options you provide it and generates pages with buttons to select the options, it self checks how many pages to gen by
NumPages = NumOptionsGiven / NumOptionCanFitOnScreen rounded to wholeNumber
say 10 options per screen
say we given 33 options, thus 33/10 rounded = 3Pages.
Also to detect what option is what button it uses the options number, ie option 1 = button 1
I could write this myself and you can add to your API if youd like, i feel pretty motivated to try
-end-
#31
Posted 14 December 2012 - 12:00 AM
Working on the angelTV update to support pastebin for pastebin movie sharing atlast! your API really makes things more easier
#32
Posted 14 December 2012 - 12:42 AM
I noticed buttons dont auto size based on text, thats ok for when you can choose how long the buttons text is but what ive the text is too long ? It just prints the text longer than the buttons length.
Perhaps have it check over the text length and button length and if text length > BLength then print the text that would be going over the button under the text
ie
'This button'
might become instead
"This Butt
on"
use
ButtonSplit[index] = string.sub(TEXT, buttonLength,string.len(TEXT))
index = index+1
its a table because we might have multiple-runovers, so keep checking the lengths till it wont run over then print text by
index = 1
for index = 1,table.maxn(ButtonSplit)
print(ButtonSplit[index])
index = index+1
end
you could also then expand the Y of the box by b = table.maxn(ButtonSplit)+1 -- plus 1 is optional, its good for spacing inside buttons.
Summary of suggestion :
allow the text that is longer than a buttons length to print over to new lines within a button
-end-
#33
Posted 14 December 2012 - 04:56 AM
ArchAngel075, on 14 December 2012 - 12:00 AM, said:
Working on the angelTV update to support pastebin for pastebin movie sharing atlast! your API really makes things more easier
#34
Posted 14 December 2012 - 05:00 AM
ArchAngel075, on 14 December 2012 - 12:42 AM, said:
I noticed buttons dont auto size based on text, thats ok for when you can choose how long the buttons text is but what ive the text is too long ? It just prints the text longer than the buttons length.
Perhaps have it check over the text length and button length and if text length > BLength then print the text that would be going over the button under the text
ie
'This button'
might become instead
"This Butt
on"
use
ButtonSplit[index] = string.sub(TEXT, buttonLength,string.len(TEXT))
index = index+1
its a table because we might have multiple-runovers, so keep checking the lengths till it wont run over then print text by
index = 1
for index = 1,table.maxn(ButtonSplit)
print(ButtonSplit[index])
index = index+1
end
you could also then expand the Y of the box by b = table.maxn(ButtonSplit)+1 -- plus 1 is optional, its good for spacing inside buttons.
Summary of suggestion :
allow the text that is longer than a buttons length to print over to new lines within a button
-end-
Oh and thanks, my goal is to make gui easy for everyone
#35
Posted 14 December 2012 - 05:13 AM
The pages idea was an branch of how i could have done the previewer in my program(i instead whent for mouse scrolling) and i noticed its useful for some things such as displaying lists >
If you take AngelTV for example :
It is editor mode and you wish to select a file to edit, it outputs pages containing the files names as buttons(or with buttons attached) and vy clicking a file name or button you will open the file in an editor... if the file you need isnt on that page then you can "turn" the page and search that one, it might output say 10 files per page and you want file 22 etc
but this needs some indepth and as i will write this myself and give you the code if you want to use it in your API instead of my adding it to cpsAPI(which i am dropping)
#36
Posted 14 December 2012 - 05:25 AM
ArchAngel075, on 14 December 2012 - 05:13 AM, said:
The pages idea was an branch of how i could have done the previewer in my program(i instead whent for mouse scrolling) and i noticed its useful for some things such as displaying lists >
If you take AngelTV for example :
It is editor mode and you wish to select a file to edit, it outputs pages containing the files names as buttons(or with buttons attached) and vy clicking a file name or button you will open the file in an editor... if the file you need isnt on that page then you can "turn" the page and search that one, it might output say 10 files per page and you want file 22 etc
but this needs some indepth and as i will write this myself and give you the code if you want to use it in your API instead of my adding it to cpsAPI(which i am dropping)
#37
Posted 14 December 2012 - 07:54 AM
bjornir90, on 13 December 2012 - 07:06 PM, said:
Oct125, on 13 December 2012 - 10:32 AM, said:
Hm ok! Thanks and sorry for not paying attention in the functions list
#38
Posted 14 December 2012 - 08:16 AM
Oct125, on 14 December 2012 - 07:54 AM, said:
bjornir90, on 13 December 2012 - 07:06 PM, said:
Oct125, on 13 December 2012 - 10:32 AM, said:
Hm ok! Thanks and sorry for not paying attention in the functions list
For future help i suggest adding this to the spoiler of the function :
gui.setButton(x,y,endx,endy,text,colorline,colorbackground)--button 1
gui.setButton(x,y,endx,endy,text,colorline,colorbackground)--button 2
gui.sRender()
gui.getSelection() --will return 1 if the button is clicked, 2 if the button 2 is clicked and so...
-end-
suggestion! : roundness, yes... i noticed we have rectangles but not round buttons, this can add a lot more, rendering out the button will be easy in my opinion, im not sure how to check its inside cords for the gui.getSelection() perhaps make it save the buttons radius as X (you can also in-depth for ovals if you save two radii X; Y.... I might write a temp of the render and the scan inside since circular buttons just climbed my priority more than pages
#39
Posted 14 December 2012 - 09:21 AM
1.It's too complicated for what it is
2.In minecraft, there is square and not round
3.It will be a bit ugly cause of the size of the pixel
Feel free to add it
#40
Posted 14 December 2012 - 09:25 AM
ArchAngel075, on 14 December 2012 - 08:16 AM, said:
Oct125, on 14 December 2012 - 07:54 AM, said:
bjornir90, on 13 December 2012 - 07:06 PM, said:
Oct125, on 13 December 2012 - 10:32 AM, said:
Hm ok! Thanks and sorry for not paying attention in the functions list
For future help i suggest adding this to the spoiler of the function :
gui.setButton(x,y,endx,endy,text,colorline,colorbackground)--button 1
gui.setButton(x,y,endx,endy,text,colorline,colorbackground)--button 2
gui.sRender()
gui.getSelection() --will return 1 if the button is clicked, 2 if the button 2 is clicked and so...
-end-
suggestion! : roundness, yes... i noticed we have rectangles but not round buttons, this can add a lot more, rendering out the button will be easy in my opinion, im not sure how to check its inside cords for the gui.getSelection() perhaps make it save the buttons radius as X (you can also in-depth for ovals if you save two radii X; Y.... I might write a temp of the render and the scan inside since circular buttons just climbed my priority more than pages
Thanks ArchAngel075!!
I'm programming in the right way now, but i'm having problems... And, one solution would be to create a function that clears the buffer without drawing it... So there is the suggestion
function bClear()
runButton = {}
runHeader = {}
coordButton = {}
end
--EDIT!!!
The current way to clear the buffer don't clear the buttons coordinates!!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











