Click here to Skip to main content
15,890,579 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: I saw the end of a rainbow the other day Pin
CDP18029-Mar-17 4:43
CDP18029-Mar-17 4:43 
GeneralRe: I saw the end of a rainbow the other day Pin
Mark Parity9-Mar-17 1:05
Mark Parity9-Mar-17 1:05 
GeneralRe: I saw the end of a rainbow the other day Pin
xiecsuk9-Mar-17 1:25
xiecsuk9-Mar-17 1:25 
GeneralRe: I saw the end of a rainbow the other day Pin
Mark Parity9-Mar-17 1:43
Mark Parity9-Mar-17 1:43 
GeneralRe: I saw the end of a rainbow the other day Pin
Mark_Wallace9-Mar-17 1:57
Mark_Wallace9-Mar-17 1:57 
GeneralRe: I saw the end of a rainbow the other day Pin
Marc Clifton9-Mar-17 2:03
mvaMarc Clifton9-Mar-17 2:03 
GeneralRe: I saw the end of a rainbow the other day Pin
Johnny J.9-Mar-17 3:05
professionalJohnny J.9-Mar-17 3:05 
GeneralNow you are going to get it Pin
CDP18028-Mar-17 23:19
CDP18028-Mar-17 23:19 
Recently I have revived my little pet project, a GUI that runs on top of a 3D engine, formerly with XNA and now with MonoGame. You wanted an article and I have finished a small sample program to demonstrate how to set up the whole thing and there is plenty left for follow up articles, like how to design and script (in XAML) a UI theme, how to use the MVP classes or layouting the views in XAML and introducing the controls.

The sample needs a little more commenting, but works fine otherwise. There is just a certain behavior that does not seem right, which ever way I make it.

Usually the 3D engine renders scenes in the background, but this will not be needed for a demo program. So I just put a large Image control with a nice background to fill the entire background and a button to end the program.

Now this is the problem: The UI must constantly figure out which control the user is pointing at and send messages to it. For that purpose there is a 'hit test' that walks through the tree of controls and determines which control is 'hit'.

Things get complicated when one control is placed on top of another, like the image and the button. Logically both have been hit and there are several ways of resolving the problem:

1) The 'hit test' goes through the complete control tree and finds all controls that have been hit. If there is more than one, it would also have to figure out which one is the topmost. This would work for any scenario, but may get a little slow with bigger control trees.

2) If two controls overlap, the topmost one must be a child of the one in the background. This way the hit test must not go through the entire tree. As soon as it found a control that has been hit, only its children must be searched for a better fit, the entire rest of the tree can be ignored. This is much faster because it can stop searching once it has a result and the question which control is in the front and which is in the background is automatically resolved by the parent/child relationship. I would prefer this one, but it has the ugly side effect that any overlapping controls that are not children would be ignored, receive no messages and just be dead.

3) I could do both, but that would not be much better than 1) alone.

So, how would you want a UI to behave? A strict parent/children design rule with dead controls if you don't comply to it? Or better a solution that always works, but may get into performance problems sooner or later?
The language is JavaScript. that of Mordor, which I will not utter here

This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a f***ing golf cart.

"I don't know, extraterrestrial?"
"You mean like from space?"
"No, from Canada."

If software development were a circus, we would all be the clowns.

GeneralRe: Now you are going to get it Pin
den2k888-Mar-17 23:31
professionalden2k888-Mar-17 23:31 
GeneralRe: Now you are going to get it Pin
CDP18029-Mar-17 0:19
CDP18029-Mar-17 0:19 
GeneralRe: Now you are going to get it Pin
Richard Deeming9-Mar-17 1:26
mveRichard Deeming9-Mar-17 1:26 
GeneralRe: Now you are going to get it Pin
Marc Clifton9-Mar-17 2:12
mvaMarc Clifton9-Mar-17 2:12 
GeneralRe: Now you are going to get it Pin
CDP18029-Mar-17 3:04
CDP18029-Mar-17 3:04 
GeneralRe: Now you are going to get it Pin
Marc Clifton9-Mar-17 3:57
mvaMarc Clifton9-Mar-17 3:57 
GeneralRe: Now you are going to get it Pin
CDP18029-Mar-17 4:42
CDP18029-Mar-17 4:42 
GeneralWSO CCC OTD 09-03-17 Pin
LabVIEWstuff8-Mar-17 22:49
LabVIEWstuff8-Mar-17 22:49 
GeneralRe: WSO CCC OTD 09-03-17 Pin
PeejayAdams8-Mar-17 23:10
PeejayAdams8-Mar-17 23:10 
GeneralRe: WSO CCC OTD 09-03-17 - WINNER!!! Pin
LabVIEWstuff8-Mar-17 23:13
LabVIEWstuff8-Mar-17 23:13 
GeneralRe: WSO CCC OTD 09-03-17 - WINNER!!! Pin
OriginalGriff8-Mar-17 23:23
mveOriginalGriff8-Mar-17 23:23 
GeneralRe: WSO CCC OTD 09-03-17 - WINNER!!! Pin
PeejayAdams8-Mar-17 23:50
PeejayAdams8-Mar-17 23:50 
GeneralRe: WSO CCC OTD 09-03-17 Pin
Duncan Edwards Jones9-Mar-17 0:37
professionalDuncan Edwards Jones9-Mar-17 0:37 
GeneralRe: WSO CCC OTD 09-03-17 Pin
PeejayAdams9-Mar-17 0:52
PeejayAdams9-Mar-17 0:52 
GeneralRe: WSO CCC OTD 09-03-17 Pin
Duncan Edwards Jones9-Mar-17 2:43
professionalDuncan Edwards Jones9-Mar-17 2:43 
GeneralRe: WSO CCC OTD 09-03-17 Pin
PeejayAdams9-Mar-17 4:07
PeejayAdams9-Mar-17 4:07 
QuestionDo Mac Users Never Use Mechanical Keyboards? Pin
Robert Vandenberg Huang8-Mar-17 21:32
professionalRobert Vandenberg Huang8-Mar-17 21:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.