Here it is. It's not perfect, because if scaled small gaps can appear in the seams. In a later implementation I used repeated textures instead to solve that problem, but it felt like a hack. May look at making a more robust version at some point.
@SinisterSoft released a window example a while ago which does 9-patches. I think I have one somewhere, I'll trawl through my junk folder and see if I can find it
@totebo, I managed to get round the gaps issue by using a RenderTarget and drawing the shapes into that first
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
function Gui:image9(m,ib,i,w,h,left,right,top,bottom,fh,fv)local tx,ty,tw,th=i:getRegion()local w3,h3=tw/3,th/3local l,r,t,b=left or w3,right or w3,top or h3,bottom or h3
local tx2,tx3=tx+l,tx+tw-r
local ty2,ty3=ty+t,ty+th-b
local tx4,ty4=tx+tw,ty+th
if fh then
tx,tx2,tx3,tx4=tx4,tx3,tx2,tx
l,r=r,l
endif vh then
ty,ty2,ty3,ty4=ty4,ty3,ty2,ty
t,b=b,t
endlocal x2,x3=l,w-r
local y2,y3=t,h-b
m:setVertexArray(0,0,x2,0,x2,y2,0,y2,
x2,0,x3,0,x3,y2,x2,y2,
x3,0,w,0,w,y2,x3,y2,
0,y2,x2,y2,x2,y3,0,y3,
x2,y2,x3,y2,x3,y3,x2,y3,
x3,y2,w,y2,w,y3,x3,y3,
0,y3,x2,y3,x2,h,0,h,
x2,y3,x3,y3,x3,h,x2,h,
x3,y3,w,y3,w,h,x3,h)
m:setIndexArray(1,2,3,1,3,4,
5,6,7,5,7,8,
9,10,11,9,11,12,
13,14,15,13,15,16,
17,18,19,17,19,20,
21,22,23,21,23,24,
25,26,27,25,27,28,
29,30,31,29,31,32,
33,34,35,33,35,36)
m:setTextureCoordinateArray(tx,ty,tx2,ty,tx2,ty2,tx,ty2,
tx2,ty,tx3,ty,tx3,ty2,tx2,ty2,
tx3,ty,tx4,ty,tx4,ty2,tx3,ty2,
tx,ty2,tx2,ty2,tx2,ty3,tx,ty3,
tx2,ty2,tx3,ty2,tx3,ty3,tx2,ty3,
tx3,ty2,tx4,ty2,tx4,ty3,tx3,ty3,
tx,ty3,tx2,ty3,tx2,ty4,tx,ty4,
tx2,ty3,tx3,ty3,tx3,ty4,tx2,ty4,
tx3,ty3,tx4,ty3,tx4,ty4,tx3,ty4)
m:setTexture(ib)return l,r,t,b
end
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Viewports can't be rotated - just in case you need to do that. (at least I don't think they can)
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Comments
Likes: oleg
Likes: oleg
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
@totebo, I managed to get round the gaps issue by using a RenderTarget and drawing the shapes into that first
Likes: oleg, totebo
https://deluxepixel.com
Likes: oleg, vitalitymobile, antix
https://deluxepixel.com
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Likes: vitalitymobile, SinisterSoft, antix
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
https://deluxepixel.com
I want to dynamically change the size Sprite1:goSize(500,99)
at any moment in the game
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
https://deluxepixel.com
Likes: SinisterSoft
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Yes
Likes: SinisterSoft
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Likes: SinisterSoft, antix
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Likes: SinisterSoft, vitalitymobile, MoKaLux
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Likes: totebo
https://deluxepixel.com
Likes: SinisterSoft
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
https://deluxepixel.com
Likes: SinisterSoft, antix, MoKaLux
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
(Thanks, in case google mis-translated)
Likes: oleg
https://deluxepixel.com
Likes: vitalitymobile
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
"And does it work with @2, @3 etc?"
I did not check
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Likes: totebo, MoKaLux
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
so fast working:
stage:addChild(clon(a,200,30))
instead:
stage:addChild(wall(200,30,50,24))
Likes: antix
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
https://github.com/razorback456/gideros_tools/commit/9e65a621b86ed16d8ddb1a4af80a00e5f5fc3738
Likes: SinisterSoft, Apollo14
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!