What a busy week it's been, I've gotten a ton accomplished. The focus for this week was all on the tools, in particular the tools associated with editing a voxel sprite.
First up was some bug fixes I needed to get out of the way, I cleaned up the grid rendering for each layer in the voxel sprite, it was rendering a couple more lines than it should have been. The other bug fix was to do with the mouse drag selection in tile placing mode, it only worked for a single layer, so I extended the selection box to select all 4 layers. It could still use some improvements though, it only really works for selecting tiles when looking at the level head on.
Next up was figuring out what tools I wanted to add for edit mode. The tools I decided on were as follows:
Load From Image
Extrude Layer by Color
Switch Grid Axis
Slide Layer Up
Slider Layer Down
Once I had an idea of the tools I wanted to build, the next step was to set up a window and some icons for selecting the different tools. So I set about to create a bunch of first pass icons to use. The first batch are sort of monotone, not a lot of detail but they get the job done. I'll have to get a UI artist down the road to clean these up.
Once I had my icons I went to add them to buttons. I ran into a bit of a roadblock here though because I realized that I hadn't set up my buttons so that I could have an image rendered on them. This wasn't a big deal I just added another asset to render on top of the buttons, but I realized that my UISprite object was only set up for scalable UI images where it separates the image into a grid of 9 images so that everything scales nicely. This was overkill for a little button image so I set up a non-scalable render mode for the UISprite that just renders the image as a simple quad.
I also started to hook up the UICopyPastable object I had created the previous week. I hooked it up to the UIEditbox for the trial run, it worked like a charm. It's nice to have copy and paste working now, makes using the edit boxes a little nicer, they still need cursors though.
Alright, that was the first day, on Tuesday I ran into a problem from setting up the copy and paste. I needed to separate out key commands that work for UI elements from Key commands set up for different edit modes. I had been meaning to do this for quite a while, my gameplan was to create groups for keyinput so that I could disable key commands based on group whenever I needed to. This took me the majority of Tuesday, testing included.
The first thing I wanted to get working was the grid axis toggle. This changed the grid within the voxel sprite between the x,y, and z axis. Next I hooked up the point drawing and line drawing I already had in place to the buttons I had set up in the edit toolbox. The first tool I really started working on was the fill tool. This is like the classic paint tool that does a flood fill across a layer. Then I added erase mode toggle which just flips the tools between placing a voxel and erasing a voxel, I made this a toggle so that erase works with all the tools, point, line, circle. Once I had finished the fill tool I figured it'd be a good time to hook all these tools up to mouse clicks, that was a fairly quick change. I also made a note that layer up and layer down weren't going to be that useful so I'm going to combine them and make a layer move tool. The next thing I realized was that I was going to need a file dialog. I came to a crossroads on this one, I knew that it was quite easy to bring up the standard windows dialog, so I had to weigh whether or not it would be worth all the extra time of implementing all the features for my own file dialog. In the end I decided that it was in my best interest to use the standard win32 dialog for now.
Thursday, since I was adding the file dialog I figured it would be a good time to switch tracks and spend some time hooking up the file dialog to things I already had in place. The first one was the main menu so that I could save and load different levels. This led me to realize that I didn't have a clean way to destroy a level. So I had to invest some time into making sure all the memory was properly freed so that I had a clean shutdown, flushing out everything properly. I'm still not 100% I got all the memory cleaned up but at least for now everything is flushing out properly. Since I had a clean shutdown now, I figured I'd add a New Level option to the main menu which just starts you out with a clean slate for building up a level.
Friday, with the Tile Edit State code starting to grow I figured it was a good time to separate out some of this code. I moved the code for the Tile Edit State and the Tile Placing State out of the main Editor Game State. All the code had already been in separate classes but it had all been living in the same cpp/h files. This was leading to some compile time issues on my little computer, plus the separation makes everything a lot cleaner. I also added a FileDialogInfo to the creation of the file dialog so I could adjust things like the default file extension and what not when I'm popping up the dialog. I also got to the bottom of a non fatal memory stomp, seems that it was caused by my group changes to the Input Watcher. I still need to dig into that one a bit deeper but it has a band-aid on it for now.
It's amazing sometimes how much you can get completed in one week!
|Showing off the new file menu|
|First look at the new edit toolbox|
|Toggling the grid axis|
|Drawing with the line tool|
|Making a closed box so I can demo the fill tool|
|Bam, fill tool!|
|Showing off the erase toggle with the draw point tool|
|This last one is showing off the palette edit, change the color in the palette and it updates the sprite.|