all: move standalone libraries to libs/ subdirectory

The root dir of our repository has grown quite a lot the past few months.

I'd like to make it more clear where the bulk of the engine lives (`src/`) and
also make it more clear which Mach libraries are consumable as standalone projects.

As for the name of this directory, `libs` was my first choice but there's a bit of
a convention of that being external libraries in Zig projects _today_, while these
are libraries maintained as part of Mach in this repository - not external ones.

We will name this directory `libs`, and if we have a need for external libraries
we will use `external` or `deps` for that directory name. I considered other names
such as `components`, `systems`, `modules` (which are bad as they overlap with
major ECS / engine concepts), and it seems likely the official Zig package manager
will break the convention of using a `libs` dir anyway.

Performed via:

```sh
mkdir libs/
git mv freetype libs/
git mv basisu libs/
git mv gamemode libs/
git mv glfw libs/
git mv gpu libs/
git mv gpu-dawn libs/
git mv sysaudio libs/
git mv sysjs libs/
git mv ecs libs/
```

git-subtree-dir: glfw
git-subtree-mainline: 0d5b853443
git-subtree-split: 572d1144f11b353abdb64fff828b25a4f0fbb7ca

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>

git mv ecs libs/

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-08-26 13:29:04 -07:00 committed by Stephen Gutekanst
parent 79ec61396f
commit 0645429df9
240 changed files with 6 additions and 6 deletions

View file

@ -0,0 +1,86 @@
const c = @import("c.zig");
const intToError = @import("error.zig").intToError;
const Error = @import("error.zig").Error;
const Aim = @import("enums.zig").Aim;
const Backend = @import("enums.zig").Backend;
const Device = @import("Device.zig");
const SoundIo = @This();
handle: *c.SoundIo,
pub fn init() error{OutOfMemory}!SoundIo {
return SoundIo{ .handle = c.soundio_create() orelse return error.OutOfMemory };
}
pub fn deinit(self: SoundIo) void {
c.soundio_destroy(self.handle);
}
pub fn connect(self: SoundIo) Error!void {
try intToError(c.soundio_connect(self.handle));
}
pub fn connectBackend(self: SoundIo, backend: Backend) Error!void {
try intToError(c.soundio_connect_backend(self.handle, @enumToInt(backend)));
}
pub fn disconnect(self: SoundIo) void {
c.soundio_disconnect(self.handle);
}
pub fn flushEvents(self: SoundIo) void {
c.soundio_flush_events(self.handle);
}
pub fn waitEvents(self: SoundIo) void {
c.soundio_wait_events(self.handle);
}
pub fn wakeup(self: SoundIo) void {
c.soundio_wakeup(self.handle);
}
pub fn defaultInputDeviceIndex(self: SoundIo) ?u16 {
const index = c.soundio_default_input_device_index(self.handle);
return if (index < 0) null else @intCast(u16, index);
}
pub fn defaultOutputDeviceIndex(self: SoundIo) ?u16 {
const index = c.soundio_default_output_device_index(self.handle);
return if (index < 0) null else @intCast(u16, index);
}
pub fn inputDeviceCount(self: SoundIo) ?u16 {
const count = c.soundio_input_device_count(self.handle);
return if (count < 0) null else @intCast(u16, count);
}
pub fn outputDeviceCount(self: SoundIo) ?u16 {
const count = c.soundio_output_device_count(self.handle);
return if (count < 0) null else @intCast(u16, count);
}
pub fn getInputDevice(self: SoundIo, index: u16) ?Device {
return Device{
.handle = c.soundio_get_input_device(self.handle, index) orelse return null,
};
}
pub fn getOutputDevice(self: SoundIo, index: u16) ?Device {
return Device{
.handle = c.soundio_get_output_device(self.handle, index) orelse return null,
};
}
pub fn getInputDeviceFromID(self: SoundIo, id: [:0]const u8, is_raw: bool) ?Device {
return Device{
.handle = c.soundio_get_input_device_from_id(self.handle, id.ptr, is_raw) orelse return null,
};
}
pub fn getOutputDeviceFromID(self: SoundIo, id: [:0]const u8, is_raw: bool) ?Device {
return Device{
.handle = c.soundio_get_output_device_from_id(self.handle, id.ptr, is_raw) orelse return null,
};
}