Skip to content

Commit 2ecbc4e

Browse files
committedJun 10, 2021
Pendulum, README to-dos
1 parent 1a32dae commit 2ecbc4e

File tree

7 files changed

+55
-10
lines changed

7 files changed

+55
-10
lines changed
 

‎.clang-format

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
3+
BasedOnStyle: LLVM
4+
UseTab: Never
5+
IndentWidth: 4
6+
TabWidth: 4
7+
BreakBeforeBraces: Allman
8+
AllowShortIfStatementsOnASingleLine: false
9+
IndentCaseLabels: false
10+
ColumnLimit: 0
11+
AccessModifierOffset: -4
12+
FixNamespaceComments: true
13+
SpaceBeforeInheritanceColon: true
14+
BreakInheritanceList: AfterColon
15+
IndentPPDirectives: AfterHash
16+
17+
...

‎Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ exp: $(EXBINS)
1818
@echo "Compiling example [m] $<"
1919
@$(CC) -o $@ $< $(CFLAGS) -L. -lm -lpluto
2020

21-
2221
%: %.c $(LIBA)
2322
@echo "Compiling example $<"
2423
@$(CC) -o $@ $< $(CFLAGS) -L. -lpluto

‎README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
<p> A library to draw graphics with pixels in the terminal </p>
44

5-
### This library is currently being refactored. I advise developing with the previous releases
6-
75
### Building
86
To generate `libpluto.a`, run:
97
```
@@ -61,6 +59,11 @@ $ gcc -o program program.c -L<path to the FOLDER where libpluto.a is located> -l
6159
<p>Conway's Game of Life written using plutonem</p>
6260
<img src="screenshots/conways_game_of_life.png" align="center">
6361

62+
### Things to do (you can contribute)
63+
- [ ] Fix colours
64+
- [ ] Colour RGB (256, 256, 256)
65+
- [ ] Polygons, rasterization
66+
6467
### Troubleshooting
6568

6669
1. Check if proper fonts are installed. Pluto uses Unicode characters from `\u2800` to `\u28FF`. I recommend the `Cascadia` font for best quality.

‎examples/density.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ int main()
1919
float x, y;
2020
for (x = 1; x < _pluto_canvas.cwidth / count; x += density)
2121
{
22-
for (y = 1; y < _pluto_canvas.cheight / 2; y += density)
22+
for (y = 1; y < _pluto_canvas.cheight; y += density)
2323
{
2424
int r = (int)(x / y);
2525
pluto_set_pix(r * x, r * y);

‎examples/graph.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ int main()
1212
{
1313
pluto_init_window(true, 35);
1414

15-
for (int x = 0; x < _pluto_canvas.cwidth; x++)
15+
for (int x = 1; x < _pluto_canvas.cwidth; x++)
1616
{
17-
for (int y = 0; y < _pluto_canvas.cheight; y++)
17+
for (int y = 1; y < _pluto_canvas.cheight; y++)
1818
{
1919
pluto_set_pix((x >> y), _pluto_canvas.cheight - 1 - (y >> x));
2020
}

‎examples/mandelbrot.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,15 @@ void create_mandelbrot()
2121
x = x_new;
2222
iter++;
2323
}
24-
if (iter < maxi)
25-
;
26-
else
24+
if (iter >= maxi)
2725
pluto_set_pix(col, row);
2826
}
2927
}
3028
}
3129

3230
int main()
3331
{
34-
pluto_init_window(true, 31);
32+
pluto_init_window(true, 35);
3533

3634
create_mandelbrot();
3735
pluto_write_out();

‎examples/pendulum.math.c

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include "../src/pluto.h"
2+
#include <math.h>
3+
#include <signal.h>
4+
#include <stdio.h>
5+
#include <time.h>
6+
7+
const int wait = 45000;
8+
const struct timespec wts = {
9+
.tv_sec = wait / 100000,
10+
.tv_nsec = (wait % 100000) * 1000};
11+
12+
int main()
13+
{
14+
pluto_init_window(true, 35);
15+
16+
for (int y = 0; y < _pluto_canvas.cheight / 2; y++)
17+
{
18+
int xb = (int)(4 * M_PI * M_PI * y / 9.8);
19+
pluto_draw_line((pt_t){xb, _pluto_canvas.cheight - 1}, (pt_t){xb, _pluto_canvas.cheight - 1 - y});
20+
21+
pluto_write_out();
22+
pluto_write_frame();
23+
fflush(stdout);
24+
nanosleep(&wts, NULL);
25+
}
26+
27+
pluto_deinit();
28+
}

0 commit comments

Comments
 (0)
Please sign in to comment.