Posts

Thirteen, a C++ library for easy pixel pushing

 <<Thirteen is a header-only C++ library that initializes a DirectX 12 window and gives you a pointer to RGBA uint8 pixels to write to, which are copied to the screen every time you call Render(). It is inspired by the simplicity of the Mode 13h days where you initialized the graphics mode and then started writing pixels directly to the screen. Just include the header, initialize, and start drawing!>> https://github.com/Atrix256/Thirteen

Second Reality - JavaScript, C++ ports

A scener has ported the classic demo Second Reality by Future Crew to JavaScript so that you can  now run it directly in your bowser. He has also released the source code of this port. It can be found at: https://github.com/covalichou/second-reality-js/tree/main Besides, there's a C++ port of the demo:  https://www.jsr-productions.com/secondreality.html

JavaScript: How to serialize maps of maps of maps of ...

Recently I had to serialize a map in JavaScript. On the Internet I found code similar to this: /* json-map.js */ export const replacer = (key, value) => {   if(value instanceof Map) {     return {       dataType: 'Map',       value: Array.from(value.entries()),     };   } else {     return value;   } } export const reviver = (key, value) => {   if(typeof value === 'object' && value !== null) {     if (value.dataType === 'Map') {       return new Map(value.value);     }   }   return value; }   Now I had the problem that this works for maps of arrays, but not for maps of maps. I pondered over it for a while and then came up with a recursive solution that does not only work for maps of maps, but also for maps of maps of maps, maps of maps of maps of maps, and so on: /* json-map.js */ export const replacer = (key, value) => {   if(value inst...

Demos for Dummies

Gargaj wrote a tutorial for newbies who want to code demos. It shows how to make a simple demo in less than 400 lines of C++ code. Link: https://gargaj.github.io/demos-for-dummies/

Diskmag Engine in C# / WPF

The repo https://github.com/adokhugi/diskmagenginewpf contains a simple but good diskmag engine made with C# / WPF.

Volko Hull - An Alternative to Convex Hull

When you have a point cloud and want to obtain the shape, you can use the convex hull or the alpha shape algorithm. In the computational geometry library I am using in my projects, CGAL, these algorithms are built-in, but they have a disadvantage: the points are not output in the correct order. I first tried to solve this problem by implementing a convex hull algorithm myself that outputs the points in the correct order, but this did not always help since it ignored concave corners. Therefore I wrote my own algorithm to replace it. My algorithm divides the rectangular area of the given cluster into four triangles and computes the points belonging to the outer border of each triangle. Thus it also includes concave corners. Imagine this to be the rectangle: -------- |\    /| | \ A/ | | C\/  | |  /\D | | /B \ | |/    \| -------- If it is a square, we can assume that its sides have a length of 2a. The coordinates of the mid point are always (0, 0). Th...

Tiny Code Christmas

Every day until christmas, the organizers of Lovebyte post a new video with tutorials on creating size-limited intros for fantasy consoles. The first video can be watched here . The official website is located here .