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 / Help with coding a mouse click on image

Author
Message
RangerEllis
13
Years of Service
User Offline
Joined: 15th Jan 2011
Location: Terrestrial Productions Current Project:
Posted: 18th Jan 2011 01:12 Edited at: 18th Jan 2011 03:48
I had a different form going about this, but it wasn't in the best form so I am moving it to this one in Dark GDK. The old one was http://forum.thegamecreators.com/?m=forum_view&t=180384&b=20.

Now my problem is I don't know how to code for a mouse click on an image to be recognized. I am trying to make a Jeopardy like game using Dark GDK and C++, and here is the code I have so far.


The coordinates are how long the image is and how tall, but when I click on the spot in the debugging window nothing happens. I even tried to change it to just a mouse click, but the images still would't delete. Any help?
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 18th Jan 2011 04:25 Edited at: 18th Jan 2011 04:26
Quote: "if (MainMenu = false)"

Use "==" for comparison. "=" is for assignment, which, in this case, will assign MainMenu as false and evaluate to true.

Quote: "dbDeleteImage (1 && 2);"

This will not work the way you want it to. "&&" is for comparison as well. "1 && 2" will end up being 1, so this line will essentially be "dbDeleteImage(1);". You must separate each one to delete more than one image.

Here is a way to do what you want:


“C++ : Where friends have access to your private members.”
-Gavin Russell Baker
RangerEllis
13
Years of Service
User Offline
Joined: 15th Jan 2011
Location: Terrestrial Productions Current Project:
Posted: 19th Jan 2011 01:33
Thanks Bran!
RangerEllis
13
Years of Service
User Offline
Joined: 15th Jan 2011
Location: Terrestrial Productions Current Project:
Posted: 20th Jan 2011 01:39
I've been working with the code you gave me, but I think that since the box is being loaded up the images aren't. It should work if I posted the images onto the boxes but how would I show one box in from of the other?
RangerEllis
13
Years of Service
User Offline
Joined: 15th Jan 2011
Location: Terrestrial Productions Current Project:
Posted: 20th Jan 2011 17:24
Never mind the other question. Ok I've been messing with the coding to make it work for me, and I got it to work, but then I tried to take off some stuff I didn't need, it still worked, but then I tried to change the way my code changed images, and it stopped working. I tried to work backwards but now it doesn't work. Here is the code so far. The images are just templates. The first one has a play text on it and the other one has a menu button on it. They are supposed to be able to go back and forth. Here it is!



Could some one please help me with this. I can't find out how it doesn't work.
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 21st Jan 2011 00:01
Quote: "int MenuShowingVariable = 1;
int JeapardyTemplateShowingVariable = 0;"


What's the point of having these two variables?

You only need one (until you add other menus, then it will become more complicated).


(I have not had the chance to test this, but in theory, it should work)

“C++ : Where friends have access to your private members.”
-Gavin Russell Baker
RangerEllis
13
Years of Service
User Offline
Joined: 15th Jan 2011
Location: Terrestrial Productions Current Project:
Posted: 21st Jan 2011 00:51 Edited at: 21st Jan 2011 14:41
/*EDITED*/
Mmm, thanks. The reason I wanted to do it with two variable because it will end up something like this cause it's a jeapardy game.




So ya thats what I hope it will work out. Thanks for the help you helped me develop the concept above! Branflakes you are awesome! Once it gets along I will post the project so that people can tell me how to improve. Until then I will need lots of help. Thanks!

/*EDIT*/ Ya I needed two variables for that because the questions. I am going to do this instead becuase it's easier.
RangerEllis
13
Years of Service
User Offline
Joined: 15th Jan 2011
Location: Terrestrial Productions Current Project:
Posted: 22nd Jan 2011 18:42
Ok now how do you code it so that when the mouse goes over an area it will change to the finger?
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 22nd Jan 2011 18:50 Edited at: 22nd Jan 2011 18:51
are you using system cursor or custom images as cursors?
for system cursors, check this out : http://msdn.microsoft.com/en-us/library/ms648393%28v=vs.85%29.aspx

RangerEllis
13
Years of Service
User Offline
Joined: 15th Jan 2011
Location: Terrestrial Productions Current Project:
Posted: 22nd Jan 2011 20:24 Edited at: 23rd Jan 2011 15:40
Thanks! I've been working on it and here is the work in progress!


And if any of you guys want the actual project post on here and I'll work it out then.

Also my c++ 2008 won't run the include iostream, using namespace std, so is there a dark gdk code I could use to animate an image when the mouse goes over it? Would a .png file work if I had it animated?
RangerEllis
13
Years of Service
User Offline
Joined: 15th Jan 2011
Location: Terrestrial Productions Current Project:
Posted: 25th Jan 2011 00:38
Wait could I load up a sprite using a .png file? Then animate it?
RangerEllis
13
Years of Service
User Offline
Joined: 15th Jan 2011
Location: Terrestrial Productions Current Project:
Posted: 27th Jan 2011 01:37
NEW QUESTION!

How do you export the project into an .exe file that is playable withough C++?
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 27th Jan 2011 07:16
run the code (in release mode!), then go to project folder -> <project name> -> release folder, you will find your exe there, make sure you put your media files with it so you app can find them

also, if you want to run it on other machines you will need directX and MSVC++ redistributables installed on the other machines (not necessary on your machine, you have the whole SDK), you can easily find them through google (search for like: msvc++ 2008 redistributable)

Red Eye
16
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 27th Jan 2011 16:16 Edited at: 27th Jan 2011 16:17
I use this code in my lua system. But i am sure you can understand whats inside the functions:



You can easily combine these to one single, consuming less CPU.

But here you go.

RangerEllis
13
Years of Service
User Offline
Joined: 15th Jan 2011
Location: Terrestrial Productions Current Project:
Posted: 31st Jan 2011 02:32
Thank you both of you!

Login to post a reply

Server time is: 2024-11-19 14:51:50
Your offset time is: 2024-11-19 14:51:50