Minor Tetzle update

I made a release of Tetzle yesterday that fixes two long-standing bugs: firstly, the mouse cursor should no longer drift off of pieces while you are moving them; secondly, the tiles should look correct no matter how zoomed the board is. Both bugs stem from the same issue: the width of the tiles don’t evenly divide, and floating point errors were cropping in.

For instance, if you have a tile that is 64 pixels wide and you want to show it as 6 pixels wide, you multiply it by 0.09375. But if the tile is 65 pixels wide, you need to multiply it by a number that can’t be properly represented as a float. And so most of the tiles will show up as 6 pixels, but some of them will be 7 and stretch the tile border to match. My quick solution was to scale the tiles on the CPU and round the values to integers before passing them to OpenGL. For the 1.3 release I plan to use a faster solution, but I wanted to release a stop-gap bugfix before then.

Advertisements

New Tetzle release

For anyone who doesn’t read the frontpage of gottcode.org, I released Tetzle 1.2 today with several new and improved features:

  • Real collision detection added by Ulrik Mikaelsson
  • Complete keyboard shortcuts added by Frank Tetzel
  • Toggling borders added by Frank Tetzel
  • Added zooming and panning to overview
  • Added retrieving pieces
  • Added option to use entire image

And then as soon as I uploaded it, my wife went and discovered a bug that has been there from the very beginning! I will be making a bugfix release shortly. 🙂

Image dialogs

I’ve replaced Tetzle’s add image dialog with the dialog from FocusWriter. When I wrote Tetzle’s dialog, I had not investigated the Model/View classes enough, and I had come to the erroneous conclusion that there was no easy way to replace QDirModel’s icons. The solution is so obvious that I can’t believe I didn’t think of it: derive a new model from QDirModel! Following that logic, I wrote a fresh version of the add image dialog for FocusWriter. The code is cleaner because of the Model/View split, and faster because I use QImageReader to scale the images (I’m not sure I can get it noticeably faster using Qt, any suggestions are most welcome).

This updating all started with an add image dialog in my recipe manager. I had originally used Tetzle’s dialog, but I replaced it with the improved dialog from FocusWriter. I fixed some bugs, and made a minor enhancement (double clicking an image selects it and closes the dialog). Once I had done that, I couldn’t leave Tetzle with an inferior dialog, so I had to update its dialog. Of course, I made changes to the dialog to make it work in Tetzle, so I had to copy my changes back to FocusWriter.

Now I’ve got three copies of the exact same code in three different projects, and that’s the path to madness and bugs. I’m trying to find a simple solution to share the code. I could go the traditional C++ route and make a library, but that seems a bit overkill for a single dialog. I’m also considering creating a separate git project for the dialog, and using it as a git submodule in my other projects. My hesitation about that is wherever I place my image dialog repository is the “master”. I like the fact that every git repository is equal in authority, and having all git repositories of a project point to the same repository for a submodule rubs me the wrong way. I’m sure I’ll think of something.

No install for you!

While testing things yesterday, I discovered that none of my projects install the executables when compiled from source. Oops. I don’t usually try to install them, so I’m not surprised I missed it. I guess nobody else does either, otherwise I expect I would’ve heard about this already.

I am going to be making releases of Gottet, NovProg2, and Tetzle today. I am also planning on making a release of CuteMaze, but that is being delayed while I work out the last few details of porting it to Qtopia4 — thanks go to Alessandro Briosi for porting CuteMaze and Gottet to Qtopia4.

Working with file previews

After a busy month, I have finally had some time to focus on Tetzle again. The first issue I decided to tackle was the “Add Image” dialog. There were a couple of things about it that bothered me, the biggest being that I could only preview one image at a time. Here is what the dialog looks like in the currently released version:

Add Image dialog in 0.6

The hardest thing about solving the file preview issue was that I couldn’t figure out how to get a QDirModel to allow me to set the icon for each file after it was shown. I tried creating a QFileIconProvider that created previews from the files, but that blocks the interface while the previews are loading. Not good. After several unfruitful hours of searching for other solutions, I switched the file list to a QListWidget. It was so much easier to work with! I don’t understand how anyone can like the new Model-View classes, I find them incredibly annoying.

The other issues were a lot simpler to solve (as I was expecting), and I finished up the new dialog yesterday. Here is what it will look like in the next release:

Add Image dialog in 0.7

Quick note

Unfortunately, I’m going to be quite busy over the next few weeks; because of this, I’m not sure when I will be able to work on Tetzle. Don’t let this stop you from downloading it and reporting any bugs, I’ll get to them as soon as I can.

Introducing Tetzle

After much work, I am finally taking the wraps off of my current project: Tetzle. The concept is simple: a jigsaw puzzle that uses tetrominoes for pieces. It’s been in development for two months now, and even though the game came along reasonably quickly I encountered some issues along the way.

The biggest issue was once again working with QGraphicsView. In the end, I gave up on it and switched to using OpenGL for rendering. Despite the hype, I’ve never had QGraphicsView perform well for me. Yes, my computer is not a very powerful machine, but it is plenty fast enough to play the things I’ve written with it! QGraphicsView is a wonderful API, but the performance is subpar. My current project translated quite well into OpenGL, so in the end it wasn’t too big of a deal.

I wasn’t expecting Tetzle to take very long to write, so I figured I would hurry up and make a playable version before talking about it. Unfortunately, it took me longer than I was expecting to write it, and I haven’t been able to devote all of my free time to it. Anyway, I’ve released a playable version. Go, enjoy! And tell me about any bugs!