Accessing ammo variables from another program

6 replies [Last post]
Hedge641
Hedge641's picture
User offline. Last seen 10 years 13 weeks ago. Offline
Joined: 2009-07-22
Posts: 14

I have recently purchased a Logitech G19 keyboard which has an LCD display built in. This LCD is often used in games to show useful status information. I would like to use my LCD screen to show me which weapons I have available in Hedgewars while it's not my turn. I'm always forgetting which weapons I have and there's no normal way to find out without opening the weapon menu during my turn.

I've downloaded the Logitech LCD SDK and read all of the info. I've created my new applet in C++ and I've got it to display "Hello world!" in the middle. Now I need to access the ammo variables in the game somehow to display them on the LCD. I have the latest SVN version of the source and I see that what I'm looking for may be in "uAmmos.pas" but it's Pascal and I don't know that language. I also don't know how to read another app's memory for the information.

Can anyone help me out? I'm using Visual Studio 2008 on Windows XP x64.

Smaxx
Smaxx's picture
User offline. Last seen 13 years 32 weeks ago. Offline
Joined: 2009-04-29
Posts: 391

I once wrote an app for the G15 as well - wasn't that hard to do.

However I wouldn't do it using another app. Thats very restricted and won't work without admin rights if you're running Windows Vista or Seven. Instead including the functionality into Hedgewars shouldn't be that hard to do - at least as a Windows only feature (not sure about Linux/Mac support). Would be possible to use a wrapper DLL that's called from pascal and then interacts with Logitech's files.

Buy me a G19 and I might be encouraged to do it. Wink Smiley

But ignoring all that: How do you intend to put all weapons on the small LCD display? Even with simplified graphics that might get crowded rather fast.

Hedge641
Hedge641's picture
User offline. Last seen 10 years 13 weeks ago. Offline
Joined: 2009-07-22
Posts: 14

Smaxx allegedly wrote:

But ignoring all that: How do you intend to put all weapons on the small LCD display? Even with simplified graphics that might get crowded rather fast.

Hi Smaxx,
Well, Hedgewars currently has 37 weapons and the G19 screen has a resolution of 320 x 240. If I used 3 columns with 12/13 icons in each column and they had a height of about 15-20 pixels then it could fit.

rbaleksandar
rbaleksandar's picture
User offline. Last seen 10 years 15 weeks ago. Offline
Joined: 2009-01-09
Posts: 685

Тhat's cheating, man. Big Grin So someone without such keyboard has to wait for his/her turn in order to see such stats and plan his/her strategy. On the other side someone WITH this kind of thing can see it all all the time. Better not implement such thing. Wink Smiley
As for the crowded thing - you can always use abbreviations for the weapons instead of graphics. But better make it with 3 letters for example:

Baz [oo] is equal to Bazooka with unlimited ammo
Mor [2] is equal to Mortar with 2 ammo
BB [1] is equal to Baseball-bat

...

HTML = How To Meet the Ladies

Here is my Unofficial Manual for HW. Hope you like it. Wink Smiley Still working on it. Don't worry. Will get it finished...Sometime in the future. Big Grin

sheepluva
sheepluva's picture
User offline. Last seen 3 weeks 5 days ago. Offline
Joined: 2009-07-18
Posts: 563

rbaleksandar allegedly wrote:

Тhat's cheating, man. Big Grin So someone without such keyboard has to wait for his/her turn in order to see such stats and plan his/her strategy.

I agree, what's next: "I have a second monitor that is being unused by Hedgewars so I'd consider it cool if it would instead display how I could kill my enemy in the next turn most effeciently"? :P

Wink Smiley

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

Smaxx
Smaxx's picture
User offline. Last seen 13 years 32 weeks ago. Offline
Joined: 2009-04-29
Posts: 391

I'd display your own weapons only while you're playing - could put the announcer balloon down there as well ... Big Grin

rbaleksandar
rbaleksandar's picture
User offline. Last seen 10 years 15 weeks ago. Offline
Joined: 2009-01-09
Posts: 685

Big Grin And if you have 2 keyboards attached, the balloon will fly from the dispay of the one to the display of the other. Big Grin

HTML = How To Meet the Ladies

Here is my Unofficial Manual for HW. Hope you like it. Wink Smiley Still working on it. Don't worry. Will get it finished...Sometime in the future. Big Grin

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]