r/lua • • Jun 25 '26
Cat2D – A Mobile-First Lua Game Engine for Android Focused on Performance
🚀 Getting Started with Cat2D – Loading and Centering an Image
Hi everyone!
I'm the creator of Cat2D, a new Lua game engine for Android focused on performance, simplicity, and community-driven development.
Today I wanted to share a simple example that loads an image and automatically centers it on the screen.
local player
local scale = 0.5
function load()
player = graphics.loadTexture("player.png")
end
function draw()
graphics.clear(0, 0, 0, 1)
if player then
local sw = system.getScreenWidth()
local sh = system.getScreenHeight()
local w = player:getWidth() * scale
local h = player:getHeight() * scale
local x = (sw - w) / 2
local y = (sh - h) / 2
graphics.draw(player, x, y, 0, scale, scale)
end
end
What this example demonstrates
Loading a texture with graphics.loadTexture()
Getting the screen resolution with system.getScreenWidth() and system.getScreenHeight()
Reading texture dimensions with getWidth() and getHeight()
Scaling an image to 50% of its original size
Automatically centering the image on any screen size
Cat2D's goal is to make creating games and applications in Lua on Android simple while still exposing powerful native features and maintaining good performance.
The engine is still evolving and I'd love feedback from other developers.
What features would you like to see in a mobile-first Lua game engine? 🐱🚀
11
u/NakeleKantoo Jun 25 '26
Abri o repositório e ta tudo em português, fala mano, é como o cara ali disse, o ecossistema lua em geral, e o povo desse subreddit, é completamente construido no open source, se me permite a pergunta, pq closed source? não é como se desse pra fazer dinheiro com isso de qualquer modo
5
u/Bright-Historian-216 Jun 25 '26
is there a github link to the engine?
3
u/adbs1219 Jun 26 '26
The name immediately reminded me of ct.js, an open-source (yes, it's important) and beginner-friendly javascript game engine that has one thing that could be helpful in mobile devices: block-based visual scripting (scratch-like). GDevelop, another open-source engine, but with mobile support, also has a visual scripting system, but with a slightly different approach (some say it's datasheet-like). Maybe their design could inspire you on how to make the experience feel more mobile-native than i.e. Godot.
1
u/Capital_Angle_8174 Jun 28 '26
Lua and Performance in one sentence lol
1
u/AwayEntrepreneur4760 Jun 29 '26
Why would you use this over love?