Skip to content

Latest commit

 

History

History
110 lines (80 loc) · 3.77 KB

sugar.md

File metadata and controls

110 lines (80 loc) · 3.77 KB

sugar

sugar. init_sugar (window_name, w, h, scale)

  • Initializes Sugarcoat for use.
  • w and h are the width and height you want for your simulated screen resolution.
  • scale is the scale factor you want for stretching your simulated resolution. You can change the behavior around scaling with the various sugar.gfx.screen_... functions.

sugar. sugar_step ()

  • Updates the sugar subsystems that need updating.
  • This function will already be called automatically if you use love.update() - otherwise you will have to call it in your code once every frame.

sugar. shutdown_sugar ()

  • Shuts down the various sugarcoat subsystems.
  • This function is automatically called on closing the application, unless you are using your own love.run.
  • Since Love2D has a garbage collector (contrarily to C++ SUGAR), this function doesn't actually need to be called at any time.

sugar. sys_battery ()

  • Get the state of the system's battery.
  • Returns, in this order:
    • Percents of battery left
    • Whether the system is on battery (true) or if it is plugged in (false)
    • Battery life remaining (in seconds)

sugar. after_render

  • Is a function callback you can define like so : function sugar.after_render() --[[...]] end
  • If it is defined, it will be called automatically every frame, after the simulated screen is rendered to the actual screen. (or to a set canvas)
  • This is intended to be used for post-processing, along with sugar.gfx.render_to_canvas(...), as an alternative to the upcoming shader Sugar system.
  • In this callback, all Sugar drawing functions will have undefined behavior. You should use the Love2D functions instead.

sugar. S

  • A table that contains the content of all the subpackages in sugarcoat.
  • You may call any sugarcoat function through sugar.S.foo().


The listed features in the following subpackage are not comprehensive, they're only big points.

  • The debug subpackage of sugar.
  • Features logs and reading + writing to clipboard.

  • The graphics subpackage of sugar.
  • Features a framework for low-resolution graphics, a palette system, a surface and spritesheet system, text drawing, and primitive drawing.

  • The input subpackage of sugar.
  • Features a simple system where you assign inputs to buttons and then check for those button's state.
  • Has controller support.

  • The maths subpackage of sugar.
  • Features turn-based angles and determinative random number generation.

  • The time subpackage of sugar.
  • Features frames-per-second locking.

  • The audio subpackage of sugar.
  • Features a collection system where you load sfx and musics, then play them through their index in the collection.

  • The utility subpackage of sugar.
  • This subpackage is unique to sugarcoat, it doesn't exist in the original Sugar.
  • Features functions to work with Lua tables.
  • Contains using_package(p, override).