|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
[PLUA 2] Checking penDown on imageHi!
After a few experiments now i got the way to make Resources and create buttons with an image. But when i saw my first button with gui.button("", 1000, "myPicDB") i was amused that i still had the border of a normal textfilled button. The only thing was: The text was removed by the image. That looks ugly and is for my ways not quite usefull. SO my question: Is there a way to create a "pure picture"-button? i tried to create a picture instead and checked the pendown x and y. then i checked if they where in the area of the picture but that is really uncomfortable. (sry, my english is lousy) WHat i exactly want is some buttons like the buttons in SrcEdit. They are just pictures, no border or anything else. Can you help me? |
|
|
Re: [PLUA 2] Checking penDown on image--- In plua@..., "krakenarm" <krakenarm@...> wrote:
> > Hi! > After a few experiments now i got the way to make Resources and create > buttons with an image. > But when i saw my first button with > gui.button("", 1000, "myPicDB") > > i was amused that i still had the border of a normal textfilled button. > The only thing was: The text was removed by the image. That looks ugly > and is for my ways not quite usefull. > > SO my question: Is there a way to create a "pure picture"-button? > i tried to create a picture instead and checked the pendown x and y. > then i checked if they where in the area of the picture but that is > really uncomfortable. (sry, my english is lousy) > > WHat i exactly want is some buttons like the buttons in SrcEdit. They > are just pictures, no border or anything else. > > Can you help me? > i made it by my own.. here is the code: make your own button with new_pic() and push it. -- borderlesspicture.lua STOPAPP = false TABLE_PICS = {} gui.menu({"close"}) function new_pic(x, y, picname, ResourceID, filename) local pic if filename == nil then pic = resource.open("Tbmp", ResourceID) else pic = resource.open("Tbmp", ResourceID, filename) end screen.moveto(x, y) if pic ~= nil then local s, picwidth, picheight = resource.size(pic) resource.draw(pic) resource.close(pic) TABLE_PICS[picname] = {x, y, x + picwidth, y + picheight} else print("[X]") end end function getpicname(x, y) if TABLE_PICS ~= {} then for key, val in pairs(TABLE_PICS) do if x>=val[1] and x<val[3] and y>=val[2] and y<val[4] then return key end end end end function makecross(x, y) screen.line(arg1-1, arg2-1, arg1+1, arg2+1) screen.line(arg1+1, arg2-1, arg1-1, arg2+1) end while 1 do ev, arg1, arg2 = gui.event() if ev == penDown then if getpicname(arg1, arg2) == "testpic" then makecross(arg1, arg2) end elseif ev == menuSelect then if arg1 = 1 then STOPAPP = true end end if STOPAPP == true then break end end |
| Free embeddable forum powered by Nabble | Forum Help |