23 lines
520 B
Lua
23 lines
520 B
Lua
local entity = require("entity")
|
|
local window = require("window")
|
|
|
|
local m = entity:from{
|
|
width = 40,
|
|
height = 20,
|
|
text = "sample text",
|
|
}
|
|
|
|
m.draw = window.draw(function (self)
|
|
love.graphics.rectangle('fill', 0, 0, self.width, self.height)
|
|
|
|
love.graphics.setColor(0, 0, 0)
|
|
for i = 1, self.height/5 - 1 do
|
|
love.graphics.line(5, 5*i, self.width - 5, 5*i)
|
|
end
|
|
end)
|
|
|
|
m.mousepressed = window.mousepressed(function (self, x, y, button)
|
|
log:log("It reads: " .. self.text)
|
|
end)
|
|
|
|
return m
|