hey,
I am trying to get a program to perform an action without a mouse key.
I have a box that follows the position of the mouse:
core::position2d<s32> m = device->getCursorControl()->getPosition();
driver->draw2DRectangle(video::SColor(100,255,255,255),
core::rect<s32>(m.X-20, m.Y-20, m.X+20, m.Y+20));
And I also have a rectangle placed in the window of my program:
driver->draw2DRectangle(video::SColor(100,100,255,0),
core::rect<s32>(1000,200,1200,400));
What im trying to do is have the program turn the rectangle a vibrant red
(255,255,0,0) when the rectangle that follows the mouse is placed on top of the large rectangle in my window.
How would i write the code for this?
a statement or loop i am guessing, but i'm not too sure how to write it.
Any help or code given would be appreciated!
thanks
only1skingle
Dwell actions PLEASE HELP!
-
- Posts: 25
- Joined: Mon Sep 27, 2010 6:51 pm
- Location: United Kingdom
-
- Posts: 25
- Joined: Mon Sep 27, 2010 6:51 pm
- Location: United Kingdom
-
- Posts: 25
- Joined: Mon Sep 27, 2010 6:51 pm
- Location: United Kingdom
sorry i have another question.
forgive me i'm not the smartes or greatest at programming or understanding it.
firstly what does this mean: template<class T> ??
also the code examples they give, how would i place that within my code as im guessing i can't just put the following:
bool irr::core::rect< T >::isRectCollided ( const rect< T > & other ) const [inline]
bool irr::core::rect< T >::isValid ( ) const [inline] .
thanks
forgive me i'm not the smartes or greatest at programming or understanding it.
firstly what does this mean: template<class T> ??
also the code examples they give, how would i place that within my code as im guessing i can't just put the following:
bool irr::core::rect< T >::isRectCollided ( const rect< T > & other ) const [inline]
bool irr::core::rect< T >::isValid ( ) const [inline] .
thanks
This is called a "Template", meaning the class is defined "more general" and it's up to you to give it a specific data type (at compile time).
E.g.: In your case this could be a rectangle based on integers, floats, doubles and the like.
For example:
creates a rectangle consisting of signed integer values (s32 or "int") where (a,b) is the upper right corner of the rect, c is the width and d the height.
You might wanna read through some examples as templates are a very integral part of the C++ programming language.
E.g.: In your case this could be a rectangle based on integers, floats, doubles and the like.
For example:
Code: Select all
core::rect<s32>(a, b, c, d)
You might wanna read through some examples as templates are a very integral part of the C++ programming language.
beer->setMotivationCallback(this);