Skip to content

Commit

Permalink
update README.md and add stdlib defs
Browse files Browse the repository at this point in the history
  • Loading branch information
NateSeymour committed Jun 18, 2024
1 parent 2bda0b9 commit e9848eb
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,21 @@ texture.draw(graph);
sf::Image image = texture.getTexture().copyToImage();
std::vector<sf::Uint8> buffer;
image.saveToMemory(buffer, "png");
```

### Sample Render
<p align="center">
<img src="docs/public/SampleRender.png" width="500">
</p>

Rendered in `unlogic-cli` with:

```c++
unlogic::Graph graph({
"a(x) := sin(x)",
"b(x) := cos(x)",
"c(x) := tan(x)",
"d(x) := sqrt(x)",
"e(x) := log(x)",
});
```
Binary file added docs/public/SampleRender.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/public/vite.svg

This file was deleted.

8 changes: 7 additions & 1 deletion src/cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ int main()
unlogic::Compiler::InitializeCompilerRuntime();

// Construct GraphRenderer
unlogic::Graph graph({ "z(x) := sin(x)", "a(x) := cos(x)", "b(x) := tan(x)" });
unlogic::Graph graph({
"a(x) := sin(x)",
"b(x) := cos(x)",
"c(x) := tan(x)",
"d(x) := sqrt(x)",
"e(x) := log(x)",
});

// Construct window
sf::ContextSettings settings;
Expand Down
2 changes: 2 additions & 0 deletions src/std/StandardLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ UNLOGIC_DEFINE_LIBFUNCTION(stdlib, pow, std::pow, UNLOGIC_ARGS(double, double));
UNLOGIC_DEFINE_LIBFUNCTION(stdlib, sin, std::sin, UNLOGIC_ARGS(double));
UNLOGIC_DEFINE_LIBFUNCTION(stdlib, cos, std::cos, UNLOGIC_ARGS(double));
UNLOGIC_DEFINE_LIBFUNCTION(stdlib, tan, std::tan, UNLOGIC_ARGS(double));
UNLOGIC_DEFINE_LIBFUNCTION(stdlib, sqrt, std::sqrt, UNLOGIC_ARGS(double));
UNLOGIC_DEFINE_LIBFUNCTION(stdlib, log, std::log, UNLOGIC_ARGS(double));

0 comments on commit e9848eb

Please sign in to comment.