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 21 Feb 2002
Offline Last Active Yesterday, 11:04 PM

#5092218 Handling Input as Generic Data (Multiple Inputs)

Posted by Endurion on 06 September 2013 - 10:40 PM

I do something similar to you. I enumerate all devices and their controls (I've got libraries for pure Win32, DirectInput and RawInput).


I differ between digital values (interpreted as button presses) and analog values (joystick axes for example). Analog axes are also mapped to digital (with threshold).


All these virtual buttons and axes can then be assigned to different actions; customizable by the player. The player can then map any buttons at will (mix joystick, keyboard, mouse).


Fun fact: Mapping the analog axis to digital lets me play jump ´n´ runs with the mouse, and it's actually playable :)

#5090528 Replacement for Xna?

Posted by Endurion on 30 August 2013 - 11:45 PM

XNA doesn't stop working just because there's no more support for it. It's a mature, working API and will continue working for a while.


You could however look into Monogame, which is a open replacement for XNA (even tries to rebuild the API 1:1) and is properly updated.

#5090132 Weird issue losing characters from std::string

Posted by Endurion on 29 August 2013 - 10:08 AM

Anything that is not C, resides in different build units (lib/dll/exe) and is interfacing means trouble if they are not built with the same exact settings.


Exact settings in the sense that the objects created in one unit may not safely be passed to a different unit if they do not compile to the same code in both.


Esp. classes from templates fall in this category. Even when they are just inside a header, every compilation unit will have it's own copy of the actual code.

#5090107 Weird issue losing characters from std::string

Posted by Endurion on 29 August 2013 - 08:27 AM

I assume you did a full rebuild?


If so, put a breakpoint at the start of ShipWright::ShipWrightLoader::Load and inspect the content of filename in the debugger.

Does the size and content match what you expect?

#5088938 [winapi] to check avaliable memory

Posted by Endurion on 25 August 2013 - 11:07 AM

Depending on how you allocate that memory Windows will let you do that (use more memory than is physically available).


Back in the old days of yore (Win 3.11) I could load and scroll on a 8 MB bitmap on a 4 MB machine. No, it was not particularely fluid, but it worked.



Checking the state is good, however having a forced abort is not. Even if you deem memory not sufficient, let it run (maybe with a warning).

#5086396 Side scrolling Tile map woes

Posted by Endurion on 15 August 2013 - 11:54 PM

You are making the mistake of having a tile based layout but not taking advantage of that at all.


Tile instances for every tile are mostly overkill.


Can't you simply load all used images into a container and have the world consist of indices into that? (And thusly reducing the map to a 2d array of bytes or ints)

Also, tiles don't really need coordinates by themselves (unless you want tiles unlocked from the grid).


The tile position can easily deduced by it's array indices, as you already do with the setlocation call.

#5084896 Winsock inside a service problem

Posted by Endurion on 11 August 2013 - 05:48 AM

Yeah, but there's also MessageBox calls in there. You won't see those. And the service waits for someone to click on the OK button :)

#5084852 Winsock inside a service problem

Posted by Endurion on 10 August 2013 - 11:20 PM

Neither will work anything GUI related towards the user. Services per default are not supposed to interact with the Desktop.


However it's possible to enable interaction manually (in the Service Manager). Not recommended though. Write a log file somewhere or use the Event Manager..

#5081899 Resize Sprite Texture with Window Resize

Posted by Endurion on 31 July 2013 - 04:28 AM

Do not use WM_SIZE to check for a lost device. There are other methods to loose a device (lock the computer, etc.).


Simply check the return value of PresentScene (D3DERR_DEVICELOST).


http://msdn.microsoft.com/en-us/library/windows/desktop/bb174714(v=vs.85).aspx nicely describes the usual issues.

#5081883 Screenshot of game window

Posted by Endurion on 31 July 2013 - 01:44 AM

Wait, what do you want to take the screenshot from? Your own game? Or a different game?


If it's your own game you should have a CreateWindow call somewhere, it would be that HWND.


If it's a different executable you can't do it simply like that. You have to hook into Direct3d. Here's a sample code, going from there should work easily: http://dxresearch.codeplex.com/

#5073524 Writing articles is good for "YOU".

Posted by Endurion on 28 June 2013 - 02:17 AM

It's the diagram at this site:





Putting it in works fine once, but if you keep re-editing and saving the article it gets messed up. If it makes a difference, I'm either using IE8 on XP or IE10 on Windows 7.

#5073310 Writing articles is good for "YOU".

Posted by Endurion on 27 June 2013 - 01:29 PM

I'd have expected more feedback about the abysmal code editor and a few of the other bugs.


The code editor sometimes starts to add my entered keys twice, albeit at different locations in the current text.

Also, the code or preview tags really like to screw up the text in between (line breaks get missing, ASCII art gets fubared).

The "Save Draft" button on the buttom doesn't do anything, the one on the top right however works.



Besides that, a lot of new and interesting articles have appeared. Keep them coming!

I'm also currently writing an article about the C64 game series I had in my journal.

#5068274 Trouble running love2d games

Posted by Endurion on 08 June 2013 - 12:45 PM

Messing with the file ownership is certainly not the way to go. While it will work on your machine, the inherent bug will still prevail on other people's PCs.


Check the locations of your files vs. the shown paths. Esp. "Program Files" can be tricky as there is virtual folder magic in there. Where do you get that path from? Does Löve provide it or do you build it yourself?

#5057411 Capturing Win32 Mouse Repeat Events

Posted by Endurion on 27 April 2013 - 11:58 PM

Can't you use WM_KEYDOWN directly with VK_LBUTTON and it's siblings?

#5051098 What windows messages should a well behaved app support?

Posted by Endurion on 07 April 2013 - 11:12 PM

You can choose to handle all or none.


Most important is that you pass ALL of them on to DefWindowProc unless you explicitely handle it and the docs say you can return a specific value from your WndProc.