Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for linking binary assets #175

Merged
merged 1 commit into from
Feb 11, 2020
Merged

Add support for linking binary assets #175

merged 1 commit into from
Feb 11, 2020

Conversation

Gadgetoid
Copy link
Contributor

This is an attempt at adding support for linking binary assets, so that map data, graphics, sound, or other useful bits and bobs can be appended to a binary without having to deal with header files.

It's used by invoking blit_asset in an example/project CMakeLists.txt.

blit_asset takes two arguments:

  1. The project name
  2. The binary file to link into the project

For example, to link the audio rising.raw into doom-fire I might use: blit_asset (doom-fire rising.raw)

There's a much more interesting take on this by @Daft-Freak - Daft-Freak@a373fa4

Which introduces the concept of executing a packer tool (in this case our sprite-builder) to perform build-time conversion of assets. This is really cool since it takes a whole manual step out of the build and avoids the user having to care about how/when their lovely image files are converted.

I think these two approaches should be combined into something that:

  • Takes an asset- be it a map, image, data, whatever
  • Accepts a "tool name" or "asset type" which governs how that asset will be transformed into binary data
  • Executes the tool against the asset
  • Converts the binary result into an object file
  • And additionally a header file with a convinient pointer at the data for the user to hook into
  • Links the result against the project

So a user can just:

#include "my-asset.h"
blit_asset (my-project sprite my-asset)

Or something similar.

@Gadgetoid Gadgetoid marked this pull request as ready for review February 11, 2020 17:12
@Gadgetoid Gadgetoid merged commit 85f1836 into master Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant