From 65ebf5d4f3bb6b2ae87d7ff6cb5139174a3f4b1c Mon Sep 17 00:00:00 2001 From: IonutParau Date: Mon, 2 Jun 2025 20:34:36 +0200 Subject: [PATCH] the sound of progress --- build.zig.zon | 64 ----------------------------------------- src/components/screen.c | 1 + src/components/screen.h | 8 ++++++ src/neonucleus.h | 19 ++++++------ 4 files changed, 19 insertions(+), 73 deletions(-) delete mode 100644 build.zig.zon create mode 100644 src/components/screen.c diff --git a/build.zig.zon b/build.zig.zon deleted file mode 100644 index 1782672..0000000 --- a/build.zig.zon +++ /dev/null @@ -1,64 +0,0 @@ -.{ - // This is the default name used by packages depending on this one. For - // example, when a user runs `zig fetch --save `, this field is used - // as the key in the `dependencies` table. Although the user can choose a - // different name, most users will stick with this provided value. - // - // It is redundant to include "zig" in this name because it is already - // within the Zig package namespace. - .name = "neonucleus", - - // This is a [Semantic Version](https://semver.org/). - // In a future version of Zig it will be used for package deduplication. - .version = "0.0.0", - - // This field is optional. - // This is currently advisory only; Zig does not yet do anything - // with this value. - //.minimum_zig_version = "0.11.0", - - // This field is optional. - // Each dependency must either provide a `url` and `hash`, or a `path`. - // `zig build --fetch` can be used to fetch all dependencies of a package, recursively. - // Once all dependencies are fetched, `zig build` no longer requires - // internet connectivity. - .dependencies = .{ - // See `zig fetch --save ` for a command-line interface for adding dependencies. - //.example = .{ - // // When updating this field to a new URL, be sure to delete the corresponding - // // `hash`, otherwise you are communicating that you expect to find the old hash at - // // the new URL. - // .url = "https://example.com/foo.tar.gz", - // - // // This is computed from the file contents of the directory of files that is - // // obtained after fetching `url` and applying the inclusion rules given by - // // `paths`. - // // - // // This field is the source of truth; packages do not come from a `url`; they - // // come from a `hash`. `url` is just one of many possible mirrors for how to - // // obtain a package matching this `hash`. - // // - // // Uses the [multihash](https://multiformats.io/multihash/) format. - // .hash = "...", - // - // // When this is provided, the package is found in a directory relative to the - // // build root. In this case the package's hash is irrelevant and therefore not - // // computed. This field and `url` are mutually exclusive. - // .path = "foo", - - // // When this is set to `true`, a package is declared to be lazily - // // fetched. This makes the dependency only get fetched if it is - // // actually used. - // .lazy = false, - //}, - }, - - .paths = .{ - "build.zig", - "build.zig.zon", - "src", - // For example... - "LICENSE", - "README.md", - }, -} diff --git a/src/components/screen.c b/src/components/screen.c new file mode 100644 index 0000000..635a60b --- /dev/null +++ b/src/components/screen.c @@ -0,0 +1 @@ +#include "screen.h" diff --git a/src/components/screen.h b/src/components/screen.h index 2acc8ce..9d826e5 100644 --- a/src/components/screen.h +++ b/src/components/screen.h @@ -1,3 +1,6 @@ +#ifndef NN_SCREEN_H +#define NN_SCREEN_H + #include "../neonucleus.h" typedef struct nn_screen { @@ -14,4 +17,9 @@ typedef struct nn_screen { int editableColors; int paletteColors; int *palette; + bool isOn; + nn_address keyboards[NN_MAX_SCREEN_KEYBOARDS]; + size_t keyboardCount; } nn_screen; + +#endif diff --git a/src/neonucleus.h b/src/neonucleus.h index bd2fa34..7a6a967 100644 --- a/src/neonucleus.h +++ b/src/neonucleus.h @@ -567,6 +567,7 @@ void nn_setEditableColors(nn_screen *screen, int count); int nn_getEditableColors(nn_screen *screen); void nn_setPaletteColor(nn_screen *screen, int idx, int color); int nn_getPaletteColor(nn_screen *screen, int idx); +int nn_getPaletteCount(nn_screen *screen); int nn_maxDepth(nn_screen *screen); int nn_getDepth(nn_screen *screen); @@ -584,15 +585,15 @@ void nn_setTouchModeInverted(nn_screen *screen, bool touchModeInverted); bool nn_isOn(nn_screen *buffer); void nn_setOn(nn_screen *buffer, bool on); -// Easy setup shortcuts. 1-4 are valid. -// Basic tiers: -// - Tier 1 has 50x16 max resolution, 1 bit color depth. 1 editable palette color, used as the accent color. -// - Tier 2 has 80x25 max resolution, 4 bit color depth. 16 fixed palette colors. -// - Tier 3 has 160x50 max resolution, 8 bit color depth. 256 palette colors, 16 are editable, 240 are fixed. -// - Tier 4 has 240x80 max resolution, 16 bit color depth. 256 editable palette colors. -void nn_screen_setBasicTier(nn_screen *screen, int tier); - nn_component *nn_addScreen(nn_computer *computer, nn_address address, int slot, nn_screen *screen); -nn_component *nn_addGPU(nn_computer *computer, nn_address address, int slot, int maxWidth, int maxHeight, int maxDepth, int totalVRAM); + +typedef struct nn_gpuControl { + int maxWidth; + int maxHeight; + int maxDepth; +} nn_gpuControl; + +// the control is COPIED. +nn_component *nn_addGPU(nn_computer *computer, nn_address address, nn_gpuControl *control); #endif