Some Border Stuff

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
flattspott
Posts: 22
Joined: Mon Aug 22, 2005 4:06 am

Some Border Stuff

Post by flattspott »

Here a little border stuff I did.

Red is a plain drawRect
Green is borderOutside
Blue is borderInside

nothing fancy, i know but this is how I came up with doing borders that are transparent in the center with an adjustable thickness.



Image

Code: Select all

--[[
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
			Border test 0.1 by flattspott
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--]]

x = 135
y = 70
w = 200
h = 100
t = 5  -- thickness
blue = Color.new(0, 0, 255)
green = Color.new(0, 255, 0)
red= Color.new(255, 0, 0)
black = Color.new(0, 0, 0)

function borderInside()
	screen:fillRect(x+t, y+t, t, h-t-t, blue)	--left (height)
	screen:fillRect(x+w-t-t, y+t, t, h-t-t, blue)	--right (height)
	screen:fillRect(x+t+t, y+t, w-t-t-t-t, t, blue)	--top (width)
	screen:fillRect(x+t+t, y+h-t-t, w-t-t-t-t, t, blue)	--bottom (width)
end

function borderOutside()
	screen:fillRect(x-t, y-t, t, h+t+t, green)	--left (height)
	screen:fillRect(x+w, y-t, t, h+t+t, green)	--right (height)
	screen:fillRect(x, y-t, w, t, green)	--top (width)
	screen:fillRect(x, y+h, w, t, green)	--bottom (width)
end

screen:clear()
screen:fillRect(0, 0, 480, 272, black)
screen:fillRect(x, y, w, h, red)
borderInside()
borderOutside()
screen:flip()
screen:save("border.tga")
	
while not Controls.read():start() do
		screen.waitVblankStart()
end
Post Reply