I also had to fix a rather funny bug. I was having problems with my character sticking to the wall (when moving right) and I thought I had fixed it, but when I had someone test it I found out that I was wrong (actually, I think I fixed it and then forgot and put the bad code back in[headshake].) Anyway, I tested it on my machine and sure enough, you could stick to the wall. This lead to me figuring out that you could actually jump up and and stick to the ceiling (which you can see a movie of here; about 290kb.)
Anyway, I fixed the sticking to the wall problem, which was being caused by my collision detection, so I assumed the same for my magnet-head syndrome. Naturally, I was wrong. The system I have setup allows the user to jump higher by holding the key-down longer; once it reaches max velocity it tells the system that you can no longer jump until you hit the ground. The problem was, I was hitting the ceiling (well, the underside of a tile; whatever) and setting the velocity to 0, so I was never reaching maximum velocity, thus the system was never told that I couldn't jump anymore.
I also attempted to setup a way to change the direction of gravity, but due to my crappy design, it won't work. So, that's out for now, but is on my wishlist for the sequel.
So, that part is done now and is at a state where it wouldn't really ruin the game because it's horrible, so I'm leaving it. If after I get some stuff in I realize that it does need to be changed, I have it to a point where it would be possible with minimal to nil interface changes.
I'm working on dftGui Version 2 because I want to use it for the debug/editor mode for my current project. I've designed it in such a way that it uses my library behind the scenes, but the interface doesn't show it (except for the dftGui components ofcourse.) The only things that are required are a IDirect3DDevice9 pointer and my skin system (which is a combination of CSS style config files and textures.)
So far I've got the event system setup, which is pretty similar to the way WinForms (I think that's it... the API used with C#.) Here is my current test code:
// My Event handlers
bool TestButton_OnClick(dft::GuiBaseControl* Control, const dft::GuiClickEvent& Event)
if(Event.DoubleClicked && Event.Control && Event.Button == InputMouseButtons::Left)
Control->SetText("OMFG I'VE BEEN CLICKED!!!");
bool TestButton_OnTextChange(dft::GuiBaseControl* Control, const dft::GuiTextChangeEvent& Event)
MessageBox(0, "TestButton_OnClick", Control->GetText().c_str(), MB_OK);
// Add a couple controls
GuiManager.AddControl(new dft::GuiLabel(dft::GuiBaseControl::SharedPtr(), 1001, "This is a label", 10, 10, 150, 32, true));
dft::GuiBaseControl::SharedPtr Control = GuiManager.AddControl(new dft::GuiButton(dft::GuiBaseControl::SharedPtr(), 1002, "Button", 250, 0, 100, 32, true));
// Set the event handlers
// Route input to the GuiManager
LRESULT CALLBACK WindowProc(HWND WndHandle, UINT Message, WPARAM wParam, LPARAM lParam)
GuiManager.InputHandler(Message, wParam, lParam);
return DefWindowProc(WndHandle, Message, wParam, lParam);
In the above code, every time I hold down control and double-left-click the button, a message box pops up. So far I've got the click, text change, move, and resize event handlers in place, with just a few more in mind.
I forgot to mention my stupid bug from last night. This stupid thing kept me up until 6am (I was getting ready to go to bed at 3am and then I started having problems.) Anyway, I was setting up my bitmap font system an creating a stateblock and ortho matrix (I use untransformed and lit vertices for my 2D objects so that I can scale, rotate, transform, and make use of the zbuffer (these are the reasons that I switched to an ortho matrix and untransformed vertices, but for some reason I don't make use of any of them at the moment...)) I should note that I'm creating an ortho matrix in the beginning of my app (the exact same values) and that is what was so wierd. Anyway, I apply my stateblock and blam, everything is blurry (kind of like it was being filtered several times.) So, I commented out all of the calls to SetRenderState(), SetTextureStageState(), SetSamplerState(), but I left in my calls to SetTransform() (why would that be the problem? I already know that I'm using exact same values[shakehead].)
So, after about an hour I finally comment out my SetTransform() and boom, it renders perfectly. So, I set out on the task to figure out wtf was going on. I quadruple checked my values (I even went through and compared each node of my matrices and everything was the same.) So, I went in search of help, in the form of #gamedev. Obviously no one had a clue what was happening (though, Cade tried to help), so I ran through my code from start to finish to see if I noticed anything out of place and I didn't see anything except for my old ID3DXSprite. So, I went through and removed that (I was switching to bitmap fonts, so I don't need it anymore.) I chop it all out and poof, all of a sudden no more blurriness.
Sadly, I have no freaking clue what went wrong or why setting my own matrix was messing up my rendering (I wasn't using ID3DXSprite, I just had all of my code wrapped in it's Begin() and End() calls. Not on purpose, I just had forgotten that I had it.) The matrix code wasn't bad (not only did I directly copy and paste it from the beginning of my program (where it was working fine), but I triple checked everything. All of my sizes were right as well as my near and far values, and I was setting the D3DTS_PROJECTION matrix.)
Anyway, back to work for me.