Javaesque library
Posted: Mon Feb 01, 2021 6:23 am
HI!
I've been working in an oop library for Löve2D for a few months. I am very pleased at the result so I'm sharing it with you guys.
https://github.com/jotapapel/javaesque-lua
It's very simple but functional.
I would really appreciate it if you could test it. So far I've had no issues with it, and I'm using it in my main game engine.
Thanks in advance.
I've been working in an oop library for Löve2D for a few months. I am very pleased at the result so I'm sharing it with you guys.
https://github.com/jotapapel/javaesque-lua
It's very simple but functional.
Code: Select all
require 'javaesque'
enum 'Colors' {
'RED', 'GREEN', 'BLUE'
}
interface 'Coloreable' {
color = Colors.RED,
set_color = function(self, color)
self.color = color
end
}
interface 'Drawable' : extends 'Coloreable' {
draw = function(self)
print(self.width, self.height, self.color)
end
}
class 'Shape' : implements 'Drawable' {
constructor = function(self, width, height)
self.width, self.height = width or self.width, height or self.height
end;
width = 10, height = 10
}
local shape1 = Shape(30, 30)
shape1:draw() -- 30 30 RED
shape1:set_color(Colors.BLUE)
shape1:draw() -- 30 30. BLUE
Thanks in advance.