Skip to content

A WIP library for using SmileBASIC-like features in Love2D!

Notifications You must be signed in to change notification settings

TheV360/Love2DSmileBASICLibrary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pretty Icon Love2D SmileBASIC Library

Want to port your games and applications over to Love2D? This library makes it easy to add Text layers, Sprites, Backgrounds, and Animations, while maintaining the SmileBASIC aesthetic!

WARNING: Due to copyright concerns, the default SmileBASIC Sprites and Backgrounds are not distributed with this library. Replace both resources/sprites.png and resources/tiles.png with their actual versions before using this library. You can also just use a different spritesheet and tilesheet, but that sorta misses the point of this entire library... (The text is distributed with this because why not)

A bunch of fish orbiting a map. There are two lines text in the top left corner that both read "Hello, world!". One is green.A grid of random sprites. Multiple fish are still orbiting a map. The map is translucent. The text is also still there, and it still reads "Hello, world!". A very large sprite reading SmileBASIC (C) SmileBoom. The sprite is at an extreme angle.Multiple lines of multicolor text fill the background. In the foreground is a small box of text. It is also at an extreme angle.

(Please note that I am not SmileBoom or associated with SmileBoom.)

Usability status!

Pretty gosh darn useable! The animation syntax is likely to change, but you can also use it the way I'm using it in game/animTest.lua

Layout

This repo is split into a bunch of separate folders and files.

  • docs/: Contains the documentation. You can read it online here!
  • game/: You don't have to worry about anything here. You can easily throw it away. This does have two three test programs that test Sprites, Backgrounds, Text, Basic Z-sorting, Animations, and... shaders? for some reason?
    • animTest.lua: A demonstration of animations!
    • apiTest.lua: WHOOAAAAAAA fish (Demonstrates loading a map from a file, Sprite callbacks, Sprite definitions, blend modes, Background callbacks, Text colors, and transparency)
    • textTest.lua: Random text colors and printing! Also shaders for some reason! This also demonstrates a "cut out" effect for text with a foreground color of 0 (transparent).
    • funky.frag: I split the shader into another file.
    • hsvtest.png and othertest.png: Both of these are used with the shader I'm messing around with.
  • maps/: For now, it contains one example map (map1.v360map) that you can use. It's in my horrible file format, too!
  • resources/: Some things in this are important, some things in this aren't.
    • characters.csv: Very important. Stolen from otyaSmileBASIC Generously donated by 12Me21. Used for the text layer's font.
    • sprites.csv: Relatively important. If you leave these out, that's completely fine. Used for Sprite definitions.
    • font_8x8.png and font_16x8.png: Not important. If you want some debug fonts, here you go. The 8x8 one is the regular SmileBASIC font. The 16x8 one is made by me.
    • icon.png: Not important. Fish.
    • sprites.png: Very important. REPLACE THIS WITH THE ACTUAL VERSION BEFORE USING. Used in SmileBASIC/sprites.lua.
    • text.png: Very important. Used in SmileBASIC/text.lua.
    • tiles.png: Very important. REPLACE THIS WITH THE ACTUAL VERSION BEFORE USING. Used in SmileBASIC/backgrounds.lua. Inconsistent naming, but okay.
  • SmileBASIC/: Contains all the modules. Or whatever they're called.
    • animations.lua: Unfinished. For animating Sprites and Backgrounds.
    • backgrounds.lua: Finished. For creating tile backgrounds.
    • smilebasic.lua: Finished? Abstract thing that Backgrounds, Sprites, and Text all inherit from.
    • sprites.lua: Finished? For creating movable, rotatable, stretchable, animatable, dyeable pieces of a spritesheet.
    • text.lua: Finished. For creating text screens and printing text to them.
    • zsorting.lua: Finished? For sorting all things that inherit from smilebasic.lua, and drawing them in order.
  • game.lua: main.lua runs this after setting up a bunch of things. I styled it after PICO-8's game loop thing. For now, it's just a game selector. If you want to modify this: use setup(), update(), and draw().
  • main.lua: This is the template I usually start with when making things in Love2D.
  • watch.lua: This is a small library that keeps track of when a condition is met, how long it has happened for, and when it stops being true. Useful for buttons and other inputs.
  • profile.lua: This won't show up in the actual repo, but it's a lightweight profiler for Love2D. Disabled by default and not included, so you have to download it from here.
  • README.MD: You're already there.

To-do

  • Add attributes to text
  • Add 8x8 tiles and 32x32 tiles. Maybe just add ?x? tiles?
  • Use C FFI structs for some internal things (such as map tiles, maybe SPDEF data), to speed the library up a bit.
  • Clean up parts of library
  • The new icon I drew has both the red and blue parts split 50/50. This is not the case in the actual Love2D logo. Too lazy to fix

Issues? Improvements?

Tell me! I really want to help people port their SmileBASIC programs to other languages so SmileBASIC can live on. Feel free to create an Issue or do a Pull Request! I don't quite know how Git works!

License

MIT License

Credits

  • V360 - Most of the code, Sprite definition listings
  • rxi - Classic, a bundled library that implements the object type I use extensively.
  • tesselode - Baton, a bundled library that implements a better input system than the one I had made before.
  • SmileBoom - Most assets, also for making SmileBASIC
  • otya - Working on a similar thing that deserves a lot of credit
  • 12Me21 - Better character listings