Skip to content

v0.1.10 RC1

Compare
Choose a tag to compare
@Gadgetoid Gadgetoid released this 10 Feb 18:49
· 1064 commits to master since this release
8997903

Quick! Change everything before release

Rename to 32blit-sdk

The repository has finally moved from pimoroni/32blit-beta to 32blit/32blit-sdk.

This change goes hand-in-hand with some other changes and you will need to:

  1. Update your tools - pip install --upgrade 32blit
  2. Update your local copy of the 32blit SDK
  3. Update any games you've published with the boilerplate

The SDK now uses find_package and you should change your CMakeLists.txt like so:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d4602d..4b2d065 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,6 @@
 cmake_minimum_required(VERSION 3.8)
 
 project(game)
-set(32BLIT_PATH "../" CACHE PATH "Path to 32blit.cmake")
 set(PROJECT_SOURCE game.cpp game.hpp)
 set(PROJECT_DISTRIBS LICENSE README.md)
 
@@ -12,10 +11,8 @@ if(MSVC)
 else()
   add_compile_options("-Wall" "-Wextra" "-Wdouble-promotion")
 endif()
-if(NOT EXISTS ${32BLIT_PATH}/32blit.cmake)
-  message(FATAL_ERROR "Define location of 32Blit API with -D32BLIT_PATH=<path to 32blit.cmake>")
-endif()
-include (${32BLIT_PATH}/32blit.cmake)
+
+find_package (32BLIT CONFIG REQUIRED PATHS ../32blit-sdk)
 
 blit_executable (${PROJECT_NAME} ${PROJECT_SOURCE})
 blit_assets_yaml (${PROJECT_NAME} assets.yml)

If you were previously specifying 32BLIT_PATH in your cmake invocation it's now 32BLIT_DIR.

Audio Reworking

32blit's audio engine has acquired an enable/disable flag: sound::enabled.

Additionally the audio waveform callback has been reworked to supply the entire AudioChannel instance. callback_waveBufferRefresh is now wave_buffer_callback and wave_callback_arg is now user_data to highlight that you can assign user_data to an audio channel irrespective of whether you plan to use it in a callback.

This change will break any games using the audio API, they need changed and recompile. Where previously the code might look something like:

channels[0].wave_callback_arg = some_ptr;
channels[0].callback_waveBufferRefresh = &callback;

//...

void callback(void *data) {
  //...
  for(int i = 0; i < 64; i++)
    channels[0].wave_buffer[i] = some_sample;
}

It should now look like this:

channels[0].user_data = some_ptr;
channels[0].wave_buffer_callback = &callback;

//...

void callback(AudioChannel &channel) {
  auto data = channel->user_data;
  //...
  for(int i = 0; i < 64; i++)
    channel.wave_buffer[i] = some_sample;
}

Finally, the wave buffer sample size has changed from 8-bit to 16-bit.

If you've previously been using 16-bit samples, you must avoid dividing them (by 256) and 8-bit samples should be multiplied by 256.

@ThePythonator has created waveform-demo to show off some of the sound effects you can achieve with the 32blit audio engine.

Temporary Files

Since it's clear that QSPI Flash throughput is considerably faster than SD throughput, a region of Flash has been designated as "temp."

This region - currently 4Mb - can be used however a game sees fit and is excellent for caching read-only game content (ROMs, okay, I'm talking about ROMs) to speed up execution.

Any file (providing it fits into the temporary area) on the SD card can be cached by opening it with OpenMode::cached:

File f("path/to/thing", OpenMode::read | OpenMode::cached);
// file has been copied to flash if possible
// cache space is reserved until close

Display Sleep

Thanks to @Daft-Freak your 32blit display and sound will now fade out after 30 seconds, helping to conserve the battery. Pressing any button or moving the analog stick will wake up your 32blit.

Blits & Bobs

@ali1234 has added support for setting window position when launching SDL games, just supply a --position x y argument. This is useful for side-by-side testing of multiplayer games.

@ahnlak has added a center() function to blit::Rect. It finds the center of the Rect.

The file flashing progress bar now shows over 160x120 resolution games. It'll show over palette modes games too but in whatever colours happen to be in your palette at the time.

@Daft-Freak has tweaked, fixed and pruned the CDC streaming used to "flash" games from your host PC to your 32blit- it should be less prone to breaking now. Additionally SD-card writes have been optimised and you may or may not see a small performance improvement when flashing games.

Games are no longer auto-launched when flashed and there's now a separate "Launch" command to... launch games. It accepts a file path to the game you wish to launch from SD card or a block number prefixed by flash:/ for a game in flash.

@andreban has improved the doom-fire demo, moving the alorithm to the render loop, so it doesn't run faster than it needs to, and adding directional wind (press the left/right d-pad buttons).

As usual, for the full list of changes see v0.1.9...v0.1.10