My brain makes things explode.
Posts tagged C++
ZuneHD – Virtual D-Pad Component for XNA 3.1
May 16th
Just finished working on a pretty basic virtual d-pad for the Zune HD/XNA Framework 3.1. It’s really rough around the edges, and certainly isn’t optimized, but it works.
Download
Source
DPadHD.dll (Managed Library)
Description
A simple, kind of messy virtual d-pad for your ZuneHD games. You can feel free to add it to your games, with or without crediting me, just don’t distribute the D-Pad or modifications of it without at least giving word that it came from me. It’ll need a fair bit of optimization and editing before it’s ready for any game that you wish to distribute, however.
Features
Position can be configured
Works similarly to the default XNA input systems
Built as an XNA DrawableGameComponent
Usage Sample
dPadManager = new Segfault.DPadHD.DPadManager(this); dPadManager.Landscape = true; this.Components.Add(dPadManager);
Creating the system is easy. First, you create it as you would any other component. You can set whether or not you want to use it in Landscape mode (which merely rotates the inputs counter-clockwise – I assume a “back-button-to-the-right” landscape view) by setting a simple boolean value, and then you add the D-Pad Manager to the components list. It will update automatically, just as the XNA input managers do by default.
Its position can be set on screen with the following code:
dPadManager.Position = new Vector2(50.0f, 12.0f);
And finally, the state of the D-Pad’s four cardinal direction buttons can be checked by retrieving the current game state:
if (this.dPadManager.GetState().IsButtonDown(Segfault.DPadHD.DPadButton.Up)) pos.X += (gameTime.ElapsedGameTime.Milliseconds); if (this.dPadManager.GetState().IsButtonDown(Segfault.DPadHD.DPadButton.Down)) pos.X -= (gameTime.ElapsedGameTime.Milliseconds); if(this.dPadManager.GetState().IsButtonDown(Segfault.DPadHD.DPadButton.Left)) pos.Y -= (gameTime.ElapsedGameTime.Milliseconds); if (this.dPadManager.GetState().IsButtonDown(Segfault.DPadHD.DPadButton.Right)) pos.Y += (gameTime.ElapsedGameTime.Milliseconds);
Enjoy. :D
C++/D3D Pong Tutorial 04: Adding Keyboard Input
Apr 25th
Tutorial Description
In the last tutorial, we established a rendering engine and got scene objects working, with basic physics. In this tutorial, we are going to implement the initial Input manager, which will be focusing on the keyboard. I was planning to include mouse input, but it turns out that DirectInput only handles the mouse in relative positioning – which is perfect for three-dimensional first-person shooter games that need to track the movement of the mouse – but it’s poor for two-dimensional casual games. For those of you that do wish to use mouse input, I will be covering it a later tutorial – the methods of getting absolute positioning will require a bit of modification to our engine.
Downloads
Please note that I’ve switched to using 7-zip in place of WinRAR for compression
Binary Only (20.4KB)
Full VS2010 Project Dir (26.8KB)
SVN Repository
As of this tutorial, I have created and added a Subversion repository on Assembla to store the code for the tutorial series. I will continue to upload the source for each tutorial – the SVN will merely contain the code as I write it, so you can feel free to play around with the code that I’m working on before I release a tutorial. Mostly, this is to help people play around with things if there’s a point where I’m slow to create the tutorial following the code (as was the case with this tutorial).
SVN URL: http://svn2.assembla.com/svn/d3dpong
Starting Words
Notice: This tutorial continues from where “C++/D3D Pong Tutorial 03” article left off. Please read it if you have not already.
Some Changes
Apr 7th
For those of you watching my Direct3D tutorial series, I apologize for the continued delay of the Keyboard Input tutorial. I’ve been having some life issues coming up recently, and have been putting in ridiculously late hours at work, all of which take priority. I also got Red Steel 2 and Final Fantasy XIII (and a DSi XL), so my time’s been stolen. Decided it was time for a fresh start on my computer (I do that every now and then), and I was too lazy to download the copy of Windows 7 Ultimate that I had pre-ordered while I was in Afghanistan, so I installed Xubuntu for a while (I feel dirty. I really don’t like Ubuntu. It takes away the only reason anybody should ever want Linux in the first place.) Don’t worry, because I backed up the project files, and I’m going to be reinstalling Windows 7 tonight – assuming I get off work at a reasonable time – and will be able to continue the D3D Pong series.
Which brings me around to my next point. Unlike what I had planned, I am probably not going to be continuing this engine after the Pong clone is complete. I just don’t seem to have the time anymore, and I feel that my time is better spent with Erin and working on other life issues than releasing these tutorials. In short, I don’t feel that I could release the series in a timely manner. Don’t get me wrong, I’m still going to be programming, and I will still be developing tutorials – even a couple series tutorials. I’m just not going to be worrying about releasing the tutorials on any sort of deadline, and most of them will be one-shot tutorials (kind of like my XBOX 360 Controller Input tutorial at CodeProject).
Sorry if this is bad news for anybody, but you gotta do what you gotta do. I’ll still be available for help, if you want it. Best place to hit me up is #snoopy at Keyboard-Failure.
Qt4
Mar 29th
As of last night, I started looking into using Qt4 for future Application development projects of mine – and damned if it doesn’t look like the best option available to me (the best alternative being writing the UI on each different platform individually). For those who don’t know, Qt4 is an immensely popular and very powerful cross-platform application library that works with C++, and is supported on a large number of machines – from 64-bit Windows desktops to 32-bit embedded Linux solutions to the wonder that is Mac OS X. All without having to change the code – all that is required is a recompile (assuming you’ve set things up properly, of course). It even supports cross-platform project (.pro) files, and has a cross-platform toolset that accompanies its SDK – including a GUI designer, a set of debugging tools, and even an IDE that ties with a MinGW compiler.
I’ve started working again on an IRC client – now under the name alienIRC (formerly SevenIRC, which was being planned solely for Windows). I’ve also decided to make it completely open-source, and intend to license it under LGPLv3, something it shares with the Qt framework that is going to power it. I’m going to be setting up a Git repository on Gitorious for the project, and will be setting up some development pages on this blog – including issue tracking, a wiki, and some other tools. Right now, my plan is to closely emulate the mIRC interface – mostly because mIRC is my favorite IRC client – and will be working to make sure it feels native on all supported platforms. I will personally be maintaining builds on Windows (32- and 64-bit), OpenSUSE 11, and Mac OS X Snow Leopard. I will primarily be using the IDE that comes with Qt, though I will work to ensure that it compiles in X-Code 3 and Visual Studio 2008/2010.
As far as alienIRC itself goes, I’m looking at the possibility of using WebKit for the chat windows’ messages. This would make it incredibly easy to add formatting, because I could easily change messages from the mIRC color character into HTML tags before adding the text to the message box. It all depends on how it runs compared to a custom text box. I also plan to implement a number of features that are popular with mIRC, such as scripting (Lua, specifically), “address books,” nick highlighting, file sharing, et cetera. I’m currently working on some UI concept work – since it will have to be different from SevenIRC’s WPF plans and the previous OS X-only alienIRC UI concept that relied on some UI elements only found on Mac (such as Drawers).
If anybody is interested in contributing to this project, send me some messages – I’d be happy to hear your input, especially on features that you feel would be good to implement. Make sure you sign up for an account on Gitorious – and that you upload your SSH keys and such. If you’ve never used Git, and you’re a Windows developer, this is a very useful link for seting it up on Windows: Git for Windows Developers: Part 1
Beh
Mar 28th
Alright, so I thought I’d give a bit of an update, since I was trying to release the next tutorial in the D3D Pong series today. I spent this week (meaning my twenty-first birthday) with my girlfriend, and while I have the code written and in usable condition (written while she was at work), I have some tinkering to do to get the mouse input working properly, and then I have to actually write up the tutorial. I’m also in the process of setting up a GIT repository for the game engine, in which I will store the latest changes to the engine. But right now, my mind is still in Phoenix, and I’m not in the mood to write up the next bit of the tutorial. I will give you a bit of a roadmap for what is to come in the future, though: (subject to change)
Tutorial 4: Input
Tutorial: Basic Collision Detection and building the Pong prototype
Tutorial: Audio
Tutorial: Piecing the Game Together
Tutorial: High Scores
Polishing Addon: Shaders
Polishing Addon: “Event”-based programming
Polishing Addon: Particle Systems

