Coder Social home page Coder Social logo

32blit-tools's People

Stargazers

 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  avatar  avatar

32blit-tools's Issues

Payload size incorrect

The generated payload size is currently set to the number of bytes in the image, and doesn't include the size of the header and palette data. This means that the Surface::load_packed function misses off the last few bytes of the image.

I've raised an issue rather than fix it because I'm not sure which is the 'right' approach - if the payload size should include everything then we can fix it here, otherwise we'll need to fix it in Surface.

Flash shorthand - 32blit flash filename.blit

I'm sick of writing 32blit flash flash --file filename.blit and I think we can hotwire the tool to accept some shorthand arguments and Do The Right Thing. As such 32blit flash filename.blit should be made to work somehow.

Auto-generated asset name contains full path if path to config is absolute

Omitting name from assets results in something like:
extern const uint8_t _home_daftfreak_workspace_32blit_music_player_assets_buttons_png[];
since CMake passes an absolute path to the config file.

Config:

assets.cpp:
  assets/*.png:

Don't know if there's a better way of fixing this than duplicating the name generation in the packer like this:

diff --git a/src/ttblit/tool/packer.py b/src/ttblit/tool/packer.py
index 4489ad3..1b2849c 100644
--- a/src/ttblit/tool/packer.py
+++ b/src/ttblit/tool/packer.py
@@ -1,5 +1,6 @@
 import logging
 import pathlib
+import re
 
 import yaml
 
@@ -183,12 +184,20 @@ class AssetSource():
         output = []
 
         for file in self.input_files:
+            name = self.name
+
+            if name is None:
+                name = '_'.join(file.relative_to(self.working_path).parts)
+                name = name.replace('.', '_')
+                name = re.sub('[^0-9A-Za-z_]', '_', name)
+                name = name.lower()
+
             self.builder_options.update({
                 'input_file': file,
                 'output_file': output_file,
                 'input_type': input_type,
                 'output_format': format,
-                'symbol_name': self.name,
+                'symbol_name': name,
                 'prefix': prefix
             })
             builder.prepare_options(self.builder_options)

(With extra .relative_to(self.working_path))

Wildcard assets must include an unecessary "name:" definition

This works:

assets/level*.tmx:
    name:

This doesn't:

  assets/level*.tmx:

It should. I'm pretty sure this is a bug.

Also more control over wildcard filenames would be nice, this outputs:

// Auto Generated File - DO NOT EDIT!
#pragma once
#include <cstdint>
extern const uint8_t asset_sprites[];
extern const uint32_t asset_sprites_length;
extern const uint8_t asset_assets_level01_tmx[];
extern const uint32_t asset_assets_level01_tmx_length;
extern const uint8_t asset_assets_level02_tmx[];
extern const uint32_t asset_assets_level02_tmx_length;

When really I'd want:

// Auto Generated File - DO NOT EDIT!
#pragma once
#include <cstdint>
extern const uint8_t asset_sprites[];
extern const uint32_t asset_sprites_length;
extern const uint8_t asset_level01[];
extern const uint32_t asset_level01_length;
extern const uint8_t asset_level02[];
extern const uint32_t asset_level02_length;

32blit setup fails messily with no internet connection

phil@StarLite:~/Development/32blit$ 32blit setup
Project name: platforms
Author name: gadgetoid
32Blit SDK path [/home/phil/32blit-sdk]: /home/phil/Development/32blit/32blit-sdk
Initialise a Git repository? [Y/n]: y
Create VS Code configuration? [Y/n]: y
Create Visual Studio configuration? [y/N]: y
Downloading boilerplate...
Traceback (most recent call last):
  File "/usr/lib/python3.8/shutil.py", line 707, in rmtree
    orig_st = os.lstat(path)
FileNotFoundError: [Errno 2] No such file or directory: 'platforms/.git'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/phil/.local/bin/32blit", line 8, in <module>
    sys.exit(main())
  File "/home/phil/.local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/phil/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/phil/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/phil/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/phil/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/phil/.local/lib/python3.8/site-packages/ttblit/tool/setup.py", line 192, in setup_cli
    shutil.rmtree(pathlib.Path(project_name_clean) / '.git', onerror=remove_readonly)
  File "/usr/lib/python3.8/shutil.py", line 709, in rmtree
    onerror(os.lstat, path, sys.exc_info())
  File "/home/phil/.local/lib/python3.8/site-packages/ttblit/tool/setup.py", line 189, in remove_readonly
    os.chmod(path, stat.S_IWRITE)
FileNotFoundError: [Errno 2] No such file or directory: 'platforms/.git'
  1. Disconnect from the internet
  2. 32blit setup
  3. Fill out details
  4. Wait while it hangs at "Downloading boilerplate..."
  5. Boom!

Should probably check to see if the boilerplate actually downloaded before continuing!

Errors should go to stderr

Error messages are currently written to stdout, along with the actual output; while this is only an issue if you're writing the output to stdout (instead of specifying an output file) it still feels wrong.

(there is also a side issue of spurious "ignoring unsupported image option" message, but I'm guessing they will go away as the tool matures!)

Handle multiple font sizes

Presently there is no way to build the same ttf file in multiple font sizes; the filename overrides entries so you only get the last one listed in the YAML.

You can work around it by having multiple copies of the ttf file, but that is ... icky. What I don't know is whether this is a simple addition, or if it breaks some of the fundamentals of parsing YAML :-)

Tests!

Entire tool needs unit tests for individual components, and tool execution tests with input/output files to ensure it actually runs as a whole.

Tool explodes with blank images

If you try to build an asset from a completely blank image, it explodes messily. Understandable because it tries to pack a palette with zero entries, but it should probably be able to detect this more nicely. The attached is a no-content png which will break it nicely :)
empty

Releases!

Configure .travis.yml GitHub Actions to release packages to pypi and GitHub for tagged releases.

Add firmware update command

  1. Check version on blit
  2. Fetch releases from GitHub
  3. compare
  4. do an "install" of firmware-update.blit if it's out of date

Serial port detection fails on WSL

I am using WSL following the setup guide here:
https://github.com/32blit/32blit-sdk/blob/master/docs/Windows-WSL.md

While following the instructions and troubleshooting section of this page:
https://github.com/32blit/32blit-sdk/blob/master/docs/32blit.md#flasher-cant-find-32blit-port

I was unable to determine how to find which port to provide to successfully push a blit to the device

Thanks to ali1234 on the discord I was finally able to manually set the port. They asked me to include the following:

python3 -m serial.tools.list_ports -v

all results return

desc: n/a
hwid: n/a

And finally:

192 ports found

Incorrect CMake output for header-only assets

You can see this with the audio-wave example (and a few others).

assets.yml:

assets.hpp:
  assets/glass.bin: glass_wav

assets.cmake:

...
set(ASSET_OUTPUTS
    "/home/daftfreak/programs/32blit-beta/build/examples/audio-wave/assets.None"
)

This results in the packer being run every build (apparently nothing complains if the rule to make a file doesn't actually make that file...)

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.