## About

Welcome to Ghoscher’s blog!

My name is Hisham Ghosheh,

I didn’t create this blog to discuss my favorite color 😉 ,I made this blog so I can share knowledge and files  with others!

Most topics here will be related to programming, gaming, graphics…

Comments are always welcome 😀

hisham.ghosheh@gmail.com

https://linkedin.com/in/hishamg

1. 21/01/2011 at 2:47 pm

so what is your favorite color ? 😀

2. 21/01/2011 at 3:41 pm

Actually it’s kind of bluish 😀

3. 21/05/2011 at 10:33 pm

Good afternoon!

Relating to 3d object picking, I followed the official XNA picking examples and yours using rays from mouse cursor, till here everything goes right as expected, but then I came accross a little problem.

I’ll explain myself with an example:
I have a textured model lets say a keyboard. It’s divided in various meshes, all the keys are in the same mesh, and user can difference between them because of the texture, how could I get the point of the mesh the user clicked to calculate which key was pressed?

If camera were static I could work with 2D projection of the scene, but I wish to do it in 3D space as then it would work from any point of view.

Thanks in advance! 😀

• 21/05/2011 at 11:33 pm

The first solution that came to my mind is this:
Create a grid over the keyboard where each key occupies one or more rectangles of the grid, you can then check for intersection between the ray & a rectangle ( a 2d rectangle in a 3d world ),
the implementation might cause some headaches because of the math involved.
An alternative is a 2 dimensional array of BoundingSpheres where each sphere is located over a key.

Sorry if I couldn’t provide much help :(, but I’ve never thought about such an idea!, Please let me know when you find a better solution :).

4. 22/05/2011 at 10:11 pm

Thanks for the idea, I’m already working on those bounding rectangles/spheres, and I’ve been busy with it, thus I forgot to answer last night. Now I need to fix problems between each model size-scale :\$
I’m not so sure about how to get the point where ray collides in the surface of the mesh.
Will give you feedback when I make some progress and show you the result once it’s done 😉

5. 23/05/2011 at 9:27 am

Using bounding volumes is easier than using a grid, you don’t actually need to find the point of intersection, you just need to know which BoundingSphere\Box the ray intersects!
Can you please comment in the Picking tutorial instead of here 🙂
You know, this is an about page!

6. 18/07/2011 at 4:22 am

XNA Gui System Update Request‏

Would it be possible to update your xna gui system so that the user can check for individual control events for each specific control in the form as opposed to checking for the same events for all the controls in the form controls at once ? This would make xna a totally event driven system very similar to Visual Basic which I why I admire the language. I am very impressed with your gui system. I am making a custom xna engine and this was exactly what I have been looking for. Please continue updating it.

Thanks a bunch,

Brad in Houston

• 18/07/2011 at 4:41 am

hmm…
I don’t fully understand the issue you’re talking about (since English isn’t my language 🙂 )
If you have a form with many controls in it, you must wire the events for each control individually, It’s okay if a control isn’t wired to any event.
If you please could explain the issue with an example & I will be glad to help.

• 18/07/2011 at 4:44 am

This snippet of code was in Game1.cs

Look at the added code I put in and you will see what I am trying to do:

```#region event handlers

void Control_Click(Control sender) //check for all controls with click event
{
if (sender != null)
Console.WriteLine(String.Format("Control \"{0}\" triggerd event onClick", sender.Name));
if (myForm.button1.Clicked == true) //check for individual control event
Console.WriteLine(String.Format("You just pressed button1"));
Console.WriteLine(String.Format("The value of myForm.textBox1.Text is: " + myForm.textBox1.Text));

}
```

Thanks,

Brad

• 18/07/2011 at 3:56 pm

There’s a misunderstanding here,
In that example I wired all controls to the same event for simplicity, for example If I had two buttons

```btn1.onClick += new EHandler(Btn_Click);
btn2.onClick += new EHandler(Btn_Click);
```

so when any button is clicked the function Btn_Click will be executed.

Controls events are completely independent from each other, what matters is how to wire them to functions, you can use one function for all the events, or you can specify a different function for each event

```// Wire btn1 click to Btn1_Click function
btn1.onClick += new EHandler(Btn1_Click);
// Wire btn2 click to Btn2_Click function
btn2.onClick += new EHandler(Btn2_Click);
```

Now each button will call a different method when clicked.

So it’s up to you how to wire controls with events.

7. 18/07/2011 at 6:22 pm

That answers and addresses my needs completely. I appreciate your knowledge. Hope to see more new exciting controls for your xna gui ! I would love to see a multi-line text box, a horizontal/vertical scroll bar, and a treeview control. You have helped me create my own xna custom gui animation engine with your fabulous gui program. 🙂

Thanks so much,

Brad

• 18/07/2011 at 6:27 pm

Thank you for the compliment :).
About the other controls : I don’t think games need such complicated controls, I wanted to keep things simple enough for a game :).

8. 18/07/2011 at 6:35 pm

Now I have the xna gui looking and behaving exactly like custom made visual basic controls ! Awesome work dude 🙂

9. 06/06/2013 at 2:13 pm

Hello Hisham,
I’m very interested in your sample of offline maps. But I was “caught” in a part. I coudn’t generate the tiles. I don’t know how to do this. Can you please help me?

• 07/06/2013 at 8:18 pm

Hi,
Simply watch the first 1.5 minutes of this video (to 1:30)

it explains how to get the map file step by step.
If you have further questions please post your comment on the tutorial page 🙂 (not the about page).

10. 02/02/2014 at 1:52 am

Hi i tried your app hexscreen.. I think you have not correctly implemented the. Touch ,as the area we touch should go inside rather than coming out. I think if screen width is 10 and i touch at 5,2 you need to take it as 5,8

1. No trackbacks yet.