Skip to content

Commit

Permalink
Updating readme
Browse files Browse the repository at this point in the history
  • Loading branch information
robrohan committed Jul 4, 2024
1 parent 071b231 commit ce9b30c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
# ℝ² C99 Vector and Matrix Library
# ℝ² Simple, C99 Vector, Matrix, UTF8 String, and Terminal Library

Single-file public domain (or MIT licensed) libraries for C (C11)
Single-file public domain headers (or MIT licensed) libraries for C (C99)

![C/C++ CI](https://github.com/robrohan/r2/workflows/C/C++%20CI/badge.svg?branch=master)
![C/C++ CI](https://github.com/robrohan/r2/workflows/C/C++%20CI/badge.svg?branch=main)

The main goal of these libraries is to be fast, and usable for games programming - with a sprinkle of machine learning and general maths.
The main goal of these libraries is to be fast, and usable for games programming - with a
sprinkle of machine learning and general maths.

This library is in the style of: https://github.com/nothings/stb

Current Libraries:

- Vector, matrix and quaternion: r2_maths.h - alpha
- Minimal unit testing: r2_unit.h - usable
- Vector, matrix and quaternion: [r2_maths.h](./src/r2_maths.h)
- UTF-8 String library: [r2_string.h](./src/r2_string.h)
- Simple ncurses like library thing: [r2_termui.h](./src/r2_termui.h)
- Minimal unit testing: [r2_unit.h](./src/r2_unit.h)

## Installation

Copy any of the header files you want to use into your code base. See the header files for
instructions (mostly you just include them).

## Using the Vector, Quaternion, and Matrix Functions

Expand Down Expand Up @@ -61,20 +69,25 @@ $ git submodule add https://github.com/robrohan/r2.git
make test
```

_Note_: If you are on windows, currently, you'll have to write something like a `test.bat` yourself (or some magic to import the files into Visual Studio). You can use `test.sh` as a template.
_Note_: If you are on windows, currently, you'll have to write something like a `test.bat` yourself (or
some magic to import the files into Visual Studio). You can use `test.sh` as a template.

### Testing in Web Assembly

To compile and run the code in web assembly, first make sure you have [emscripten setup](https://emscripten.org/docs/getting_started/downloads.html), working, and the `emcc` environment variables setup:
To compile and run the code in web assembly, first make sure you have
[emscripten setup](https://emscripten.org/docs/getting_started/downloads.html), working, and the `emcc`
environment variables setup:

```sh
source ~/Projects/spikes/emsdk/emsdk_env.sh
```

Then just run `make test_wasm` or if you wish run `test.sh` passing in the `emcc` compiler and output to `html`:
Then just run `make test_wasm` or if you wish run `test.sh` passing in the `emcc` compiler and output
to `html`:

```sh
CC=emcc OUT=run_tests.html ./test.sh
```

You can then use run some sort of http server within the main directory ([busboy](https://github.com/robrohan/busboy) for example), and then load the HTML page in your browser.
You can then use run some sort of http server within the main directory
([busboy](https://github.com/robrohan/busboy) for example), and then load the HTML page in your browser.
7 changes: 7 additions & 0 deletions r2_strings.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
/* r2_strings - v0.0 - public domain very basic, utf8 string library
no warranty implied; use at your own risk
!!NOTE!! this code was **heavily** influenced by the code here:
https://rosettacode.org/wiki/UTF-8_encode_and_decode#C
It's hard to find a license on that site for the code, but the whole site
is release under the "GNU Free Documentation License 1.2" which is
unclear if that applies to just learning from the code. For my part
the license below applies, but *use at your own risk*.
Built in the style of: https://github.com/nothings/stb
This is written with game development in mind.
Expand Down

0 comments on commit ce9b30c

Please sign in to comment.