Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 17 Jul 2007
Offline Last Active Feb 15 2012 01:02 PM

Topics I've Started

Game graphics released to public domain! (mostly tiles)

03 May 2011 - 08:37 AM

As I now have released my first game I am releasing most of the graphics
used in the game as public domain, and some of the graphics was
never used in the game I released. In total it's more then 700 files,
most of them are tiles/animated tiles (64*64). Their quality differ,
after all I'm not a graphics artist, but I hope that they can be
useful to folks out there anyway.

These files are released to public domain. You're free to use these for
any purpose, free or commercial. Please drop me a mail if you plan to
use them, it would be fun to see what they are used for!
(use the email button on the site)

You can preview some of them pasted in a picture by clicking here:

The zip file with the graphics is available here, check the download section:

My first game completed!

30 April 2011 - 11:51 AM

After spending a lot of my spare time I've released my first game!
It's a tile-based 2D platformer named Alexander where you have to find
his cap to move to the next level. It didn't turn out as polished as I
wanted from the beginning but it is still playable.

It's intended as a game for children so it's not too hard too complete.
Walk with the arrow keys, jump with space and use return to view/use
inventory. (configurable)

To run the game you will need DirectX 9 and the Visual Studio 2008 SP1

The game is available at http://www.hypermotion.se under the download section.

Screenshot: http://www.hypermoti...screenshot2.png

DirectInput EnumDevicesBySemantics call fail

17 July 2007 - 08:00 AM

Hi all! As a DirectX newbie I've trying to get DirectInput actionmapping working. My code fails at the EnumDevicesBySemantics call returning E_INVALIDARG. After checking with other source code, MS and running in debug mode to check the values I still can't pinpoint where the error is. I hope anyone here can guide me in the right direction... First the header file:
// This header file sets different values returned by the input functions.

// The guidActionMap is a unique GUID for every application. This one is
// generated from within Visual Studio using Tools | Create GUID. Select
// static const struct GUID and generate. This GUID is unique, so create a new
// one if copying/pasting this code to another application.

// {8E38161D-F56C-4f9f-96E1-68D53EA54CCA}
static const GUID ACTIONMAP_GUID = 
{ 0x8e38161d, 0xf56c, 0x4f9f, { 0x96, 0xe1, 0x68, 0xd5, 0x3e, 0xa5, 0x4c, 0xca } };

// Below are different game actions defined. They define the different actions the
// player can take. These actions are later mapped using action mapping.

#define INPUT_XAXIS              1L             //Movement in the X axis
#define INPUT_LEFT               2L             //Move left
#define INPUT_RIGHT              3L             //Move right
#define INPUT_YAXIS              4L             //Movement in the Y axis
#define INPUT_UP                 5L             //Move up
#define INPUT_DOWN               6L             //Move down
#define INPUT_SHOOT              7L             //Well, guess what...
#define INPUT_SELECT             8L             //Used for something?
//#define INPUT_SHIELD             9L             //Activate shields
#define INPUT_JUMP               10L            //Jumping...
#define INPUT_BOOST              11L            //Speed up!

#define INPUT_PAUSE              12L            //Pause game
#define INPUT_MUTE               13L            //Mute sound/music
#define INPUT_SOUNDUP            14L            //Raise volume
#define INPUT_SOUNDDOWN          15L            //Lower volume
#define INPUT_QUIT               16L            //Quit game

#define INPUT_NACTIONS           25L            //Number of defined actions in action map
#define DI_BUFSIZE               16             //Directinput input buffer size
#define DI_MAXDEVICES            10             //Maximum number of detected DirectInput devices

LPDIRECTINPUT8 gp_DI=NULL;                      //Pointer to DirectInput object
LPDIRECTINPUTDEVICE8 g_lpDevices[DI_MAXDEVICES]; //Array of pointers to enumerated devices
int g_iDevices=0;                               //Holds numer of enumerated devices for array

static DIACTIONFORMAT g_ActionFormat;           //Structure with genre, buffer size axis scaling etc

// The data below sets up the action map for DirectInput. Each game action is
// assigned to at least one virtual control or device object. The controls are defined
// as action-mapping constants and are defined by genre and sub-genre.

   // Assign actions with controls, these are set up by DirectInput

   // Assign actions for keyboard

   { INPUT_LEFT, DIK_LEFT, 0, (LPCSTR)"Left", },
   { INPUT_RIGHT, DIK_RIGHT, 0, (LPCSTR)"Right", },
   { INPUT_UP, DIK_UP, 0, (LPCSTR)"Up", },
   { INPUT_DOWN, DIK_DOWN, 0, (LPCSTR)"Down", },
   { INPUT_SHOOT, DIK_F, 0, (LPCSTR)"Shoot", },
   { INPUT_JUMP, DIK_J, 0, (LPCSTR)"Jump", },
   { INPUT_BOOST, DIK_B, 0, (LPCSTR)"Boost", },
   { INPUT_SELECT, DIK_S, 0, (LPCSTR)"Select", },
   { INPUT_PAUSE, DIK_SPACE, 0, (LPCSTR)"Pause Game", },
   { INPUT_MUTE,DIK_MUTE, 0, (LPCSTR)"Mute Sound", },
   { INPUT_SOUNDUP,DIK_VOLUMEUP, 0, (LPCSTR)"Increase Volume", },
   { INPUT_QUIT, DIK_ESCAPE, 0, (LPCSTR)"Quit Game", },

   // Assign actions for mouse
   { INPUT_XAXIS, DIMOUSE_XAXIS, 0, (LPCSTR)"Left/Right", },

and after the header some code:
HRESULT hr;                                     //Result returned from calls

hr=DirectInput8Create                           //Get DirectInput pointer interface
   (GetModuleHandle (NULL),                     //Module handle for this application
   DIRECTINPUT_VERSION,                         //Version of DirectInput application designed for
   IID_IDirectInput8A,                          //Use ANSI version of the interface
   (VOID**)&gp_DI,                              //Address of ptr to receive interface ptr
   NULL);                                       //Do not use COM aggregated interface

if (FAILED (hr)) AppError (26,hr);              //If failed to create DirectInput interface pointer

ZeroMemory (&g_ActionFormat, sizeof (DIACTIONFORMAT)); //Clear the structure first

g_ActionFormat.dwSize=sizeof (DIACTIONFORMAT);  //Size of structure
g_ActionFormat.dwActionSize=sizeof (DIACTION);  //Size of action structure

// Calculate size of action map and number of entries

g_ActionFormat.dwDataSize=INPUT_NACTIONS * sizeof (DWORD);

// The guidActionMap is a unique GUID for every application. This one is
// generated from within Visual Studio using Tools | Create GUID. Select
// static const struct GUID and generate. This GUID is unique, so create a new
// one if copying/pasting this code to another application.

g_ActionFormat.guidActionMap=ACTIONMAP_GUID; //Setting GUID for the actionmap

g_ActionFormat.dwGenre=DIVIRTUAL_ARCADE_PLATFORM; //Set genre
g_ActionFormat.rgoAction=g_GameAction;          //Array with actions
g_ActionFormat.dwBufferSize=DI_BUFSIZE;         //Size of input buffer
g_ActionFormat.lAxisMax=100;                    //Axis max value
g_ActionFormat.lAxisMin=-100;                   //Axis min value
strcpy_s (g_ActionFormat.tszActionMap,"Game Controls\0"); //Friendly name of action map
g_ActionFormat.hInstString=NULL;                //String action names are defined with actions

hr=gp_DI->EnumDevicesBySemantics                //Apply the mappings to physical devices
   (NULL,                                       //User string name, NULL=login name
   &g_ActionFormat,                             //Adress to ActionFormat structure
   Input_EnumDevicesCallback,                   //Callback function for each found device
   NULL,                                        //Value to send to callback function
   DIEDBSFL_ATTACHEDONLY);                      //Scan attached and installed devices only

if (FAILED (hr)) AppError (27,hr);              //Call error function if failed
And that's pretty much it. My application fails calling the AppError above. /Anders EDIT: Please remember 'source' tags in future.