EHS/README.md

119 lines
3.6 KiB
Markdown
Raw Normal View History

2024-02-01 02:03:22 -08:00
# About
2024-02-01 02:06:03 -08:00
Much like boost.io this library is a replacement of the standard C/C++ libraries. It provides most features needed when
designing applications in a cross-platform manner. The goal for this project is for it to be compiled and run on
anything which means embedded hardware support.
2024-02-01 02:03:22 -08:00
2024-02-01 02:43:36 -08:00
This project does not fully follow the C++ standard.
2024-02-01 02:03:22 -08:00
### Features
- Audio IO/Processing/Manipulation
- Image Processing/Manipulation
- 3D Model & Mesh Processing/Manipulation
- File IO
- Basic File Monitoring
- Console IO
- 2/3/4D Vectors
- 2x2/3x3/4x4 Matrices
- Hardware/Software Level Math Functions
- Smart Pointers
- Threads
- Mutexes
- Semaphores
- CPU information and features at runtime
- HTTP(S) Sockets
- TCP Socket
- UDP Socket
- COM (Serial) IO
- UTF_8/16/32 Character Encoding
- Spotify Integration
- Twitch Integration
- Json Parsing/Writing
- User Friendly HID Input
- Basic Garbage Collector
- Linked List
- Array
- Vector
- Asynchronous Task System
- URI Parsing
### Supported Architectures
- AMD64
- AARCH64
### Supported Operating Systems
- Windows
- Linux
2024-02-01 01:24:00 -08:00
# Compiling
## Prerequisites
### Windows
- [Visual Studio Community](https://visualstudio.microsoft.com/vs/community/)
2024-02-01 02:14:43 -08:00
- [Netwide Assembler](https://www.nasm.us/)
2024-02-01 01:24:00 -08:00
- [CMake](https://cmake.org/)
### Linux
2024-02-01 02:14:43 -08:00
- **Arch Linux**: `sudo pacman -S gcc nasm cmake alsa-lib libxcb xcb-util-cursor`
- **Debian Linux**: `sudo apt install gcc nasm cmake libasound2-dev libxcb1-dev libxcb-xinput-dev libxcb-cursor-dev`
For building on the Raspberry Pi instead of the Netwide Assembler (NASM), GCC's Assembler is used.
2024-02-01 01:24:00 -08:00
## Building
### Linux
1. `cmake -DCMAKE_BUILD_TYPE=Release -DLINUX_WINDOW_SYSTEM:STRING=XCB /path/to/source`
2. `cmake --build /path/to/build --config Release`
2024-02-01 02:06:03 -08:00
The `LINUX_WINDOW_SYSTEM` variable in the first step can be either `XCB` for the X Window System or `Wayland` for the
Wayland Window System. Wayland support is currently not fully supported yet, use only `XCB`.
2024-02-01 01:34:38 -08:00
2024-02-01 01:24:00 -08:00
# Simple Example
2024-02-01 01:25:58 -08:00
```cpp
2024-02-01 01:24:00 -08:00
#include <ehs/EHS.h>
#include <ehs/io/Console.h>
void LogRaised(const ehs::Log& log)
{
ehs::Array<ehs::Str_8> tags = log.GetTags(); // Retrieves the tags from the log such as line number, function, etc...
ehs::Str_8 result = "{";
for (ehs::UInt_32 i = 0; i < tags.Size(); ++i)
{
result += tags[i];
if (i != tags.Size() - 1)
result += ", ";
}
result += "} (" + ehs::Str_8::FromNum(log.GetCode()) + "): " + log.GetMsg(); // Adds the error code and message from the log.
ehs::Console::Write_8(result);
}
2024-02-01 01:34:38 -08:00
ehs::Int_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer)
2024-02-01 01:24:00 -08:00
{
// Simple identifying meta-data for the logger.
*appName = "Simple Example App"; // The application's name
*appVerId = "Release"; // The app's version prefix; i.e. Alpha, Beta or Release as an example.
*appVer = {1, 0, 0}; // The app's version major, minor and patch number.
ehs::Console::Attach(); // Attach to the console.
ehs::Log::SetCallback(LogRaised); // Sets the log callback function for outputting the information to console.
ehs::Console::Write_8("How old are you?"); // Write to the console in UTF_8 character encoding.
ehs::Str_8 response = ehs::Console::Read_8(); // Read from the console in UTF_8 character encoding.
if (!response.IsNum())
{
ehs::Console::Clear(); // Clear the console's buffer.
return Main(appName, appVerId, appVer); // Repeat process if given response is not a number.
}
ehs::UInt_8 age = response.ToDecimal<ehs::UInt_8>(); // Converts the string number into a number based primitive.
ehs::Console::Write("Your age is " + ehs::Str_8::FromNum(age) + "."); // Write the console with the age converted back to string.
return 0;
}
```