examples: Load all images from Memory (using embedFile) instead of File
This commit is contained in:
parent
ed0d9c100f
commit
b5737af9cd
3 changed files with 4 additions and 4 deletions
|
|
@ -53,7 +53,7 @@ pub fn init(app: *App, engine: *mach.Engine) !void {
|
|||
.rows_per_image = @intCast(u32, atlas_size.height),
|
||||
};
|
||||
|
||||
const img = try zigimg.Image.fromFilePath(engine.allocator, "examples/assets/gotta-go-fast.png");
|
||||
const img = try zigimg.Image.fromMemory(engine.allocator, @embedFile("../assets/gotta-go-fast.png"));
|
||||
defer img.deinit();
|
||||
|
||||
const atlas_img_region = try texture_atlas_data.reserve(engine.allocator, @truncate(u32, img.width), @truncate(u32, img.height));
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ pub fn init(app: *App, engine: *mach.Engine) !void {
|
|||
.min_filter = .linear,
|
||||
});
|
||||
const queue = engine.gpu_driver.device.getQueue();
|
||||
const img = try zigimg.Image.fromFilePath(engine.allocator, "examples/assets/gotta-go-fast.png");
|
||||
const img = try zigimg.Image.fromMemory(engine.allocator, @embedFile("../assets/gotta-go-fast.png"));
|
||||
const img_size = gpu.Extent3D{ .width = @intCast(u32, img.width), .height = @intCast(u32, img.height) };
|
||||
const cube_texture = engine.gpu_driver.device.createTexture(&.{
|
||||
.size = img_size,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue