Giter Site home page Giter Site logo

gamesrightmeow / playbit Goto Github PK

View Code? Open in Web Editor NEW
60.0 60.0 0.0 1.27 MB

Playbit is a framework for creating cross-platform Playdate games from a single Lua codebase.

License: MIT License

Lua 100.00%
game-development game-engine love2d lua playdate playdate-console

playbit's People

Contributors

notpeter avatar shillysit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

playbit's Issues

Add support for language server plugins

All language server plugins mark preprocessor blocks and import lines as errors, since they're not actually part of native lua.

Might be able to configure this plugin to work correctly? Need to at least treat imports and preprocessors blocks as comments so that they aren't picked up as syntax errors.

Playdate fonts with a tracking value set loaded in Love2d don't have the same length as when loaded on Playdate

Using the Rains-1x font from the SDK:

local font = playdate.graphics.font.new("fonts/font-rains-1x")
local width = font:getTextWidth("Lorem ipsum dolor sit amet, consectetur")
print(width)
Playdate = 311
Love2D = 312

I believe this is an issue in Love2d where that it appends some extra padding from getWidth(str). Need to find a way to control this, or come up with some hacky workaround...

Add Mac support to Build script

Lua doesn't have a native way to detect the user's system. My workaround is rather hacky: run a command and confirm its output matches what's expected for that platform.

Windows and Linux (Ubuntu at least) are currently working, but I don't have access to a Mac to implement support.

local function detectPlatform()
if platform > -1 then
return
end
local command = io.popen("ver")
local output = command:read("*a")
if output and string.match(output, "Microsoft Windows") then
platform = module.WINDOWS
else
-- TODO: actually do a test for Linux - does linux have a ver command?
platform = module.LINUX
end
-- TODO: MAC?
end

Implement CoreLibs/object

I've been taking a look at implementing CoreLibs/object, as my game makes pretty heavy use of it. As far as I can see, there's nothing that's really specific to playdate in the CoreLibs implementation, aside from a couple places that use +=. I've replaced those two lines so that it'd work in Love, and just straight up copied it into playbit, and that seems to work, though I'm not really sure if that's what we'd want/are entitled to do given that the file is (c) Playdate, and there's this particular clause of the SDK License.

You will not:
...
- Use the SDK to develop applications for other platforms or to develop another SDK, without express written permission from Panic.

Though I'm not sure how it could really be reimplemented in any meaningful way that isn't just... rewording the existing CoreLibs implementation.

Write a custom love.run()

Playbit currently executes all game code within love.draw(). The downside to this is any called made outside of playdate.update() don't work in Love2d (but work on Playdate). Using a custom love.run() handler should fix this: https://love2d.org/wiki/love.run

Find a way to read image size from font atlas

Since Lua doesn't have a native way to read dimensions of images, the fnt-to-bmfont tool make a hacky assumption based on a quirk of Caps:

--[[
Lua does not have any native way to read image size.
However most fonts won't have less than 16 chars, and Caps
won't put more than 16 chars in a row. So we can infer the
image size based on this.
--]]
-- just in case, lets warn if I forget about this.
if #input.glyphs < 16 then
error("There are less than 16 characters in this font, so image size won't be correct: "..inputFntPath)
end
input.texWidth = input.tileWidth * 16
input.textHeight = input.tileHeight * math.floor(#input.glyphs / 16)

Maybe use a command line tool? Image Magick's identify might do the trick. Though this will add another CLI dependency.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.