Skip to content

Instantly share code, notes, and snippets.

View kdchambers's full-sized avatar
🎯
Focusing

Keith Chambers kdchambers

🎯
Focusing
View GitHub Profile
@kdchambers
kdchambers / text.cpp
Created October 26, 2021 17:44
This file is responsible for taking a font file (E.g ttf) and creating a texture bitmap containing all the requested glyphs at the desired size. This texture is then sampled by the vulkan engine to render text to screen
// SPDX-License-Identifier: GPL-3.0
// Copyright (c) 2021 Keith Chambers
// This program is free software: you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software Foundation, version 3.
// NOTE: This snippet is taken from https://github.com/kdchambers/VulkanGUIExample/blob/master/text.cpp
// This file is responsible for taking a font file (E.g ttf) and creating a texture bitmap containing all the
// requested glyphs at the desired size. This texture is then sampled by the vulkan engine to render text to screen
#include "text.h"
@kdchambers
kdchambers / chainedarray.cpp
Created October 26, 2021 17:35
Data structure that chains fixed sized arrays together to avoid unnecessary calls to heap
// SPDX-License-Identifier: GPL-3.0
// Copyright (c) 2021 Keith Chambers
// This program is free software: you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software Foundation, version 3.
// NOTE: This snippet is taken from https://github.com/kdchambers/kpl/blob/master/include/kpl/chainedarray.h which
// is part of the kpl library. This data structure is used when you extent to use a reasonably small amount of data
// but need the assurance of being able to allocate large amounts of data in some rare scenarios.
@kdchambers
kdchambers / core.zig
Last active October 26, 2021 17:46
Update function for a simple modal-based test editor that uses Vulkan for the graphics API.
// SPDX-License-Identifier: GPL-3.0
// Copyright (c) 2021 Keith Chambers
// This program is free software: you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software Foundation, version 3.
// NOTE: This gist is a snippet from https://github.com/kdchambers/zedikor/blob/main/src/core.zig
// The update function is used to check what changes have occurred due to user input and whether
// vertexes need to be updated and screen re-rendered.
fn update(allocator: *Allocator, app: *GraphicsContext) !void {
const WrappedType = struct {
// Assumption that this field would be taken out for runtime and therefore not affect the size of WrappedType
comptime const gaurantee: TypeProperties,
data: u64,
};
const TypeProperties = enum {
isA,
isB
};