Advertisement

Detecting Mouse click in-game

Started by December 05, 2000 08:37 AM
1 comment, last by LordKaT 24 years, 1 month ago
Hey all... So far I have a ''thing'' (not realy a game) that just scrolls around 640x480 on an 800x600 screen (the map is 640x480, the rest is just black ATM) My question is, Im thinking of implementing a command system on the lower portion o the screen (item, save game, et al.) and on the right hand side show the characters in the party and their stats (hp/mp, gold et al.) But right now, Im looking for a way to detect mouse clicks at a certain area (like 650,440-650,460) and that would do something (bring up a menu, save the game, ect..) Anyway, any help is appriciated --Lk
well, the way i do UI stuff is to have a number of objects represent the various UI controls. within each control, i keep a POINT that keeps track of the upper left corner of the control, and width and height members to keep track of the size. you could also use a RECT to do this.

these objects are kept in a list (there is a main list, then each control has a list of child controls that belong to it, but i don''t know how complicated your scheme is), and when a mousemove/click/etc occurs, it first gets sent to this list, which tries to find which control the input belongs to. if it doesnt find one, then it does whatever its supposed to do with the mouse event when no control gets the event.

Get off my lawn!

Advertisement
Hey TANSTAAFL, hows the book going and when the results of the contest gonna be known? And did you get my entry?

Possibility

This topic is closed to new replies.

Advertisement