Every now and then I decide to update my blog’s theme. It’s not that there was anything really wrong with the old theme, but I just like the change from time to time.
I think it’s the first time however that the blog is running a bright/white theme instead of the dark one. While I do like dark themes, the ones I’ve used in the past always made it feel like the theme itself is blending too much with the content. Maybe increasing the font color and adjusting some styling would have helped, but in some strange way, brighter themes also seem a bit more professional or more mature. I’m not trying to make this blog anything special, I just want to try something new.
Continue Reading “Theme Update”
If you’re reading this on the actual blog website and not through RSS or similar, then you might have already noticed, that I’ve changed the WordPress design. Although I really liked the old one, it has some troubles with the titles and lacked a clean separation between the posts. The current theme ‘Emire’ hasn’t been modified in any way, but I might add a custom header in the future.
In addition to the new theme I’ve also added a new plugin, which allows you to share my posts with the two-step share buttons. So you won’t get tracked by Google or Facebook, but still got the ability to share it directly from my posts. Strange enough the buttons don’t appear always (like when I’m logged in), so I’m not sure if everyone will be able to see them.
As for the announcement part, I’ll be starting a series of posts related to various computer science topics. There isn’t a fixed plan or any greater goal, but I just want to recycle the stuff I’m learning at the university and having to rephrase everything in my own words, seems like a good way to let it sink in and got the additional benefit of sharing knowledge with others. If you’re interested in a specific topic, let me know in the comments/e-mail/Twitter and I’ll see what I can do about it.
As promised here comes a small update on the TileMapCreator; screenshot first:
So this must seem disappointing, nothing really changed, except maybe the gray square on the grid. But then again I’ll have to remind you that TMC is far from being useable and the biggest changes will happen in the codebase which then again don’t necessarily need to be visually present in the application. What did then change?
In the old version I just had one class Grid which handled all the selecting and highlighting decisions next to the rendering part. This ‘method’ got quickly out of hand and there was no useable way to keep track of every cell and its states. But if one ‘object’ has different states why would I want to try really hard to synchronize different vectors? Why not just use another class? So I introduced the new class Cell for which exist just one header file. One cell keeps track of the states highlighted, selected, changed and filled. Additionally if also hold a shared_ptr to the texture or nullptr if the cell doesn’t hold a tile.
For the grid rendering I also thought about for quite a bit, actually it was the first part I changed, and I’ve chosen the following render steps.
for each cell
if the cell has changed
draw the blank sprite to clear the cell
if the cell is filled
if the cell is selected
if the cell is highlighted
draw the grid overlay
if one cell has changed
update the grid texture
This assumes an iteration over all cells doesn’t cost much time. Also I always clear the cell because it’s possible that the tile as some transparent pixels, rendering it on old content would produce a wrong image. This seems to work quite well.
Another approach I could think of would be using multiple render textures for different layers and then combine them at the end. But I don’t really see how it would make a difference in performance and it would probably only increase the GPU memory usage.
As you can see in the screenshot the highlighting already works (again). When ever your mouse cursor hovers over a cell it will get highlighted once and when you leave it, it will get ‘unhighlighted’ and the next cell will get highlighted.
Next up will be selection. For that I’ll have to store the selected cells in a vector or a similar data structure, to tell the grid which should be shown as selected and later to tell the events like delete or place where to work their magic.