Skip to main content

rubenwardy's blog

Posts

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

Android: Complete, generic data-binding RecyclerView adapter

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

Data binding greatly reduces the amount of code you need to connect user-interfaces with ViewModels. It keeps Activity and Fragment code small, and makes it easier to manage lifecycles.

<EditText
    android:id="@+id/username"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:text="@={viewModel.username}"/>

I discovered that there was no attribute to bind the elements in a RecyclerView, due to the fact that a RecyclerView needs an adapter to be able to create element views. It would also be nice to automatically use data binding to create the viewholders. There are a number of guides to do both of these halves, but I now present the code to do the whole.

Read more of "Android: Complete, generic data-binding RecyclerView adapter"

The cover of "A Comparison of SFML GUI Libraries: TGUI vs SFGUI vs ImGui"

A Comparison of SFML GUI Libraries: TGUI vs SFGUI vs ImGui

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

SFML is an excellent library that can be used to create 2D games and similar applications in C++. It’s an abstraction over OpenGL and various system APIs, presenting a consistent and easy-to-use interface.

Providing a Graphical User Interface (GUI / UI) API is out of scope for SFML. GUIs are complicated, and there’s no single good way to implement them. The S in SFML stands for Simple but GUI code rarely is.

There are many different options to choose from when making GUIs. This article is an in-depth comparison of the options for making GUIs in SFML, discussing their pros and cons.

Read more of "A Comparison of SFML GUI Libraries: TGUI vs SFGUI vs ImGui"

The cover of "Rendering a topdown world with layers and z-levels using SFML"

Rendering a topdown world with layers and z-levels using SFML

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

Ruben’s Virtual World Project is a game I’ve been working on for almost 4 years now. Recently I rewrote the rendering code to support voxel lighting and multiple z-level - heights of the map.

Read more of "Rendering a topdown world with layers and z-levels using SFML"

Getting rid of YouTube Music's "Are you still listening?" dialog

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

YouTube Music is a great way to listen for music for free, and with no adverts if you use an adblocker. There is one annoying problem however: after listening for a while, Youtube will keep pausing the music to show a dialog which says “Are you still listening?”. This article will show how to automatically confirm the dialog.

Read more of "Getting rid of YouTube Music's "Are you still listening?" dialog"

C++: Self-registering functions using macros for test libraries

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

Google’s C++ testing library has a nice syntax for registering tests, without needing to remember to add the tests to some central index. This article will show how to use macros to allow the creation of tests using only the following code:

Test(IntegerComparisonTest) {
    int a = 3;
    assert(a == 3);
}

Read more of "C++: Self-registering functions using macros for test libraries"

Porting C++ programs from Linux to Windows using vcpkg, CMake, and Visual Studio

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

Recently I had to reinstall Windows to debug a hardware issue. I decided to try to make the most of this by trying to build my game on Windows.

Read more of "Porting C++ programs from Linux to Windows using vcpkg, CMake, and Visual Studio"

RimWorld: Create timelapse from Progress Renderer on Linux

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

Progress Renderer (Steam | GitHub) is a brilliant mod that takes a screenshot once a day, and dumps it into a folder.

The following bash script can be used to generate an mp4 timelapse of the screenshots. Simply specify a region to cut out of the screenshots, and some other parameters, and run the script in the working directory.

Read more of "RimWorld: Create timelapse from Progress Renderer on Linux"

The cover of "Raytracer and Rasteriser"

Raytracer and Rasteriser

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

I wrote a raytracer and a rasteriser as part of my university course. The raytracer supported features such as indirect lighting, reflection, refraction, and a photon mapper capable of simulating the final positions of 60,000,000 photons in a few minutes (and quite a few GBs of RAM).

Read more of "Raytracer and Rasteriser"

Interactive Commit Sorter for Changelogs

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

I wrote a Bash script to sort git commits into buckets, to be used as the first step of making a change log. It supports rewording commit messages, can be stopped and resumed, and supports automatic filtering based on keywords.

Read more of "Interactive Commit Sorter for Changelogs"

Finding and copying DLLs from MinGW-W64 directories to bin directory

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

After cross-compiling your project for Windows, you find that it crashes due to missing DLLs. I will show how to identify any required DLLs using objdump, and copy them to your build directory.

Read more of "Finding and copying DLLs from MinGW-W64 directories to bin directory"

Rubix: My Simple Kernel written in C for arm

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

During the second year of university, I created a kernel for the ARMv7 instruction set. I went above and beyond what was required on this project, achieving a clean design and features such as a blocked process queue, piping, kill, and a simple filesystem. This was my favourite coursework so far. I found it very interesting to learn about and implement the things that we take for granted as programmers.

I tried to stick to POSIX as much as possible, and stuck to the Linux method of having everything as either a file or process. Because pipes and standard in/out were both “files”, I was able to implement both popen and piping of the output of a process to another process.

Read more of "Rubix: My Simple Kernel written in C for arm"

The cover of "Minetest at Freenode Live 2017"

Minetest at Freenode Live 2017

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

Shara and I exhibited on behalf of Minetest at Freenode #Live. Our stall had a computer where visitors could play Minetest. We talked about it and handed out leaflets.

If you’d like to support Minetest, then please get involved and consider donating:

Read more of "Minetest at Freenode Live 2017"

The cover of "Install Autodesk Maya on Ubuntu 17.04"

Install Autodesk Maya on Ubuntu 17.04

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

Whilst Maya claims to have Linux support, it only officially supports RedHat and CentOS Linux. It is, however, still possible to install it on Debian and Ubuntu based systems with some leg work.

Read more of "Install Autodesk Maya on Ubuntu 17.04"

The cover of "RVWP: Multiplayer Topdown Sandbox Game in C++"

RVWP: Multiplayer Topdown Sandbox Game in C++

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

For the last two years, I have been working on a very ambitious game. The game is a top-down sandbox with multiplayer support. I’m aiming towards a city-based game, where players can wander around a procedurally generated city. One of the main reasons I started creating this game is to learn about multiplayer networking at a low level - client-side prediction, server-side reconcilliation, cheat preventation, and reducing the visual effect of latency.

Read more of "RVWP: Multiplayer Topdown Sandbox Game in C++"

Mingw-w64 and CMake: unrecognised option -rdynamic on Ubuntu

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

I had an issue where CMake was failing on a compiler test with the following error:

error: unrecognized option '-rdynamic'

The problem was that CMake caches settings such as compiler flags in CMakeCache.txt, so you need to clear the cache when changing the platform. Do this by deleting CMakeFiles and CMakeCache.txt

Read more of "Mingw-w64 and CMake: unrecognised option -rdynamic on Ubuntu"

The cover of "OpenCV: compile images (Mats) into a strip"

OpenCV: compile images (Mats) into a strip

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

I created a very short C++ snippet to accumulate a series of Mats into a single Mat strip. It works like acc = acc + m - a new mat is added to the accumulator each time, then stored in the accumulator again.

Read more of "OpenCV: compile images (Mats) into a strip"

How to emit a single particle using SFML's Thor Particle System

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

Usecase: shells dropping in sync with firing, fake bullets, etc

You must use a particle emitter to create particles, however this doesn’t mean it’s impossible to create single particles on command. You can create a particle emitter which simply adds particles from a queue to the system

Read more of "How to emit a single particle using SFML's Thor Particle System"

How to center a SFGUI window (sfg::Window)

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

Simply get the SFGUI window size using GetAllocation, the sfml window size using getSize, then do this arithmetic:

auto window = sfg::Window::Create();
auto win_rect = window->GetAllocation();
sf::Vector2f size(win_rect.width, win_rect.height);
window->SetPosition(((sf::Vector2f)rwindow->getSize() - size) / 2.0f);

Read more of "How to center a SFGUI window (sfg::Window)"

Setting up a MonoDevelop solution and project for RimWorld modding

Andrew Ward

rubenwardy

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

This tutorial will show you how to create a new MonoDevelop solution and project, and how to properly connect it to RimWorld. You’ll need to have an installation of Mono that supports .NET 3.5 - here is a tutorial on how to install it.

Read more of "Setting up a MonoDevelop solution and project for RimWorld modding"