Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / [DGDK.net] Changing the mouse cursor to an image

Author
Message
jasuk70
22
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 15th Oct 2007 12:17
Hi,
I'm trying to turn the mouse pointer into an image. What do peeps think the best way to do this is? The instructions say that I need to pre-set up images in the IDE. (I'm assuming this is just left over from the DBPro manual.

Unless someone can suggest a better way, I'm assuming I will have to hide the mouse and draw the image on the screen myself based on the mouse coordinates.

Cheers,

Jas

----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 15th Oct 2007 15:42
Windows API might be key here. It allows that - not sure about mult color though - but I am PRETTY sure it allwos this also. I recommend this because I personally see the standard windows Cursor when I run DarkGDK apps and DBPro.

jasuk70
22
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 15th Oct 2007 16:05
After looking further into it. I'm going to go my original route,

Hide the mouse and create a sprite, and in each game loop move the sprite to the mouse's location.

It think that'll end up the easiest.

Cheers,

Jas

----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 15th Oct 2007 16:43
Understood. Definately Easiest. Benefit of using the MS Cursor - would be when your application is in a window say - and the mouse grazes over your app the cursor switches to your custom one and switches back when it goes off your app's window. That is nice - you may have trouble knowing when to hise the sprite - not sure. Gotta go - wanted to respond - until then

jasuk70
22
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 15th Oct 2007 16:57
The runtime engine that this is going into will be run full screen. I'm running in a window at the moment to make debugging easier.

To explain fully what I'm doing:

I have a backpack component in my runtime engine



When a player clicks on an inventory item, I want the mouse cursor to turn into that item until they click in another inventory slot or click outside of the box (When it will return the item back to it's original slot).

Eventually I'll turn it into a drag and drop but I want to get it working in an easier way first and leave fancying it up till a later version

Jas

----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 15th Oct 2007 19:05
Quote: "The runtime engine that this is going into will be run full screen. I'm running in a window at the moment to make debugging easier."


I do that too - easier to recover and see what happened when a error thrown.


Quote: "I have a backpack component in my runtime engine"
- You really do come up with some neat stuff - this looks cool.

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 15th Oct 2007 19:19
(Sorry for double post - I clicked Post on accident...wasn't done)

I was about to say in response to:
Quote: "Eventually I'll turn it into a drag and drop but I want to get it working in an easier way first and leave fancying it up till a later version "


Come on Jas... you and I both know you really mean "I just want it to work so I can code other parts of the game that are more fun." I could be wrong - but I get this "Disease" often. Facing it now in Iron Infantry - I REALLY REALLY want to get to the Voxel Folliage type stuff - and make plants and things - BUT - I probably should work on the whole "Underwater" thing as I just finished making a reasonable water shader - ability to toggle, and ability to make that shader take into account the current SkyBox theme - (Nice touch if I may say so.. beats generic blue - but now I have to make a bunch of water tiles for those NOT using the shader )

Regardless - I have Water issues Open - right now its good enough to "Go on to something else" but I know if I do - I'll probably never get back to it - and if/when I do - I'll have to relearn the code possibly all over again - at least well enough to know if my "new work" makes sense with what I did before - (e.g. Try to enhance and accidently corrupt and break)

Maybe I'm sounding a bit rough around the edges - but my heart is in the right place. I want to try to encourage you to make that system work 100% - Now versus later - and put enough stuff in the design to allow ya to "Reskin" for other games you might make - to just get it done - and try to get it done right.

It is looking SO FREAKING cool - and until you do what I suggest - you will likely feel like there is this FLAW or Thorn in your side.

I offer a deal - I'll hold off the foliage and more culling research and stuff - for making landscape rendering more enhanced and pretty - until I finish the Water System completey if you finish the drag Drop - (Not implement into gamme 100% - Just the ability to Drag, and capture the "Destination Drop Area" and the ability to Slingshot the item back into backpack if "Doesn't work/apply to game problem in game or user putting item back because they finsihed.

Sound like a deal? heheh - Just playing - but its a real deal.

You see - the water thing is complicated by the fact that I've set up the "water system" so far so that you can have various bodies of water - at different altitudes - so Going "Under Water" is going to involve altitude and probably a raycast to discern if I'm under the "Most Likely" water body - then Change visuals and audio. (Far Cry I THINK has just the one water level - then its just altitude (y). I don't expect a ton of underwater action yet - but - if I am building a system for displaying/playing in a terrain - I should do that - and try to do it well.

I Can't wait to see what you game is starting to look like. I love the inventory backpack idea.

jasuk70
22
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 15th Oct 2007 20:05
Actually, The way the components are designed and the input works, currently it's not possible at the moment

I am holding off re-designing all this until later due to the fact I have lots more components to make. Once I have got them in their basic forms. I then will have a good idea about how to modify everything using the new more streamlined flashy system.

I work from a Functionality First, Flashy stuff later principle.

Based on what I have learnt doing this, my next task is to modify the editor to create items in a different way so they work better with the runtime.

I'm currently doing the more interesting stuff at the moment . The fact that I'm going back to the editor and changing structures etc. Isn't what I'd prefer to be doing but I'm going to do it anyway to enable me to get the things to work correctly.

Anyway time to go home from work and get on with it

Jas

----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"
jasuk70
22
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 16th Oct 2007 00:04
Ok as I'm new to sprites...

I'm trying to position the sprite on the screen. The code I'm using to draw the sprite on the screen is:



But it always seems to create 2 sprites, one stays in the same position and the other moves with the mouse as you can see with the attached screen shot.

I'm sure I'm not doing something right but I'm not sure what it is.

Jas

----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"

Attachments

Login to view attachments
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 16th Oct 2007 01:24
I think sprites are weird. The First Part - Where you "Make The Sprite" - well - You Use thast over and over - Same ID - it doesn't Make it again - I'm Pretty Sure... but only worked with a couple helping my son take a stab at programming. Basically - Its kinda Smart when you think of it. If(Not Create){Create}else{Reuse}; seems to already be "in there"

kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 16th Oct 2007 05:09
Yep, you can call oDBSprite.Sprite to position the Sprite, it only creates a new one if the ID has not been used, otherwise, it just positions it.

Thiago
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 16th Oct 2007 05:20
That is actually pretty cool. (Though kinda knocked me off guard because its quite different from other "ID" requiring things in the Libs - like object, effect, light, vector etc. They OVER WRITE not reuse. Works for me though. I hope it works for Jasuk70

jasuk70
22
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 16th Oct 2007 11:23
Thanks for that.

I'll change the code to:



And give it a go tonight.

Jas

----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"
jasuk70
22
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 17th Oct 2007 11:42
Now that I have changed the code It seems to work great. Thanks for the help on the sprites.

One thing to mention. I originally planned not to re-draw all the components every loop, only re-draw when they change in some way. But switching on sprites has put the mockers on that. The 3d window when I get to that bit would fit in the middle of the screen with 2d on the outside of it. (Basically to get as much performance as possible)

So when I did this change and started to use a sprite, the whole screen cleared each loop, so I am now making the loop refresh the component every time (the base component class has this function as part of the contract (Interface) so all components can have RefreshDisplay called without knowing what the component is). And I was pleasantly surprised to see no visible difference in the response time.

Doing it this way solves lots of headaches in the future and may end up causing me to make my components more efficient in the future, which is always a good thing

Jas

----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"
jasuk70
22
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 19th Oct 2007 11:17
Got a bit further, I've done enough to show a small demo of the backpack.

Pack Example (early)

Is an example of the pack so far. You can pick up items, it will then grey out any slots that cannot receive that item (And it will not highlight the slot when the mouse goes over it). When you are holding an item you can try and drop it, but that doesn't quite work yet .

To exit this demo close the dos window that opens up.

Jas

----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"
jasuk70
22
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 5th Nov 2007 22:48
It now seems to be working. You can download the example from here:

http://www.tyranntrpg.org/pack_example_finish.zip

It uses a new data system at the back end which handles all moving items around.

Jas

----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 5th Nov 2007 23:17
Looks good

Niels Henriksen
Working on a (MMO)RPG right now in LightEngine
http://noggs.netopcom.dk/forum/default.asp - Forum for the game

Login to post a reply

Server time is: 2025-05-17 20:06:31
Your offset time is: 2025-05-17 20:06:31