Skip to content

Posts...

Page 19 of 42

Create a Background with Vertical Lines of Different Colours

January 17, 2016Category: Software
I've got a list of colours (RGB) in an array and I want to build a background with vertical lines, each representing a colour from my list. The process is too simple to put in a TL;DR :) If my list of colours is, Array<Vector3> cols, then the process is as follows: Create a pixmap: Set one pixel…

Stream from a String Instead of CIN in C++

January 11, 2016Category: Software
TL;DR : You can stream from a string instead of STDIN . Code is simple and is listed below. A project I did recently had a requirement to overload the >> operator use and STDIN to load data. The problem was not the overload itself, but the fact that testing would introduce a manual side. To get…

Load Glyphs with LibGDX

January 3, 2016Category: Software
TL;DR : Remember to give the font loader the list of characters to render from the font! I'm trying to get a more resolution-independent mechanism to load simple shapes in place. After investigating SVG loading for several days I got nowhere. Then, I found out that libGDX actually supports vector…

Don't Use Assert() If You Don't Mean It (C++)

December 26, 2015Category: Software
I found the hard way that assert() in C/C++ exists hard. This post explains that you get a SIGABRT . So, if you want your code to be testable, you better throw an exception instead. I defined a macro: So, in a code like this: You'll get an exception with the message "1 > 2" . Useful. You can…

Trick C++ on Unused Variables

December 24, 2015Category: Software
If you enable warning on unused method parameters ( -Wextra or -Wunused) and you get warnings in method parameters, you're supposed to change the signature. Sometimes this is not OK and you still need the build to pass cleanly. Java has the glorious @SuppressWarnings, so my best and most portable…

Simple Floating Point Equality Check in C++

December 21, 2015Category: Software
TL;DR : Here you can see a handmade comparison function for floating point values. While working on a C++ project using templates, I had to perform an equality to see if two values are identical. While the == is OK for integer values, it is not really OK for floating point values. At that point, you…

Build a Simple Makefile

December 20, 2015Category: Software
TL;DR : If you don't have anything better to do, create Makefiles by hand :) Gist here . The other day I went back to origins with building a small C++ project. With modern tools, all went OK. However, deployment was a bit of a problem, in the sense the host had an obsolete toolchain: So, I had to…

Generate Amazon Underground Launcher Icons

November 26, 2015Category: Software
TL;DR : Use (adapt) the script below to automatically generate the Amazon Underground application launcher icons. I was toying with the idea to build an Amazon Underground version of one of my applications. According to their rules, you need to: Repackage your app Name custom permissions (Lollipop…

Fix "Damaged app" Message

November 17, 2015Category: IT
TL;DR : Use xattr -rc /location/MyApplication.app (see here ). I use to save all my apps on my NAS. The other day I wanted to use an old app for colour palette. I've downloaded it from my NAS and...: “MyApplication” is damaged and can’t be opened. Delete “MyApplication” and download it again from…

RGB to HSV to RGB - for Shaders

November 15, 2015Category: Software
TL;DR : Go here to get the RGB->HSV and HSV->RGB conversion functions for shaders. The other day I tried to tint a colour in a texture (or rather all texture) with a different colour. It's quite easy to rotate things around, but, if you want to do it parametrically, you'll need something a bit…
PreviousNext

All tags