Need help with really basic stuff painting on mouse hover

Hello World! (see what i did there?)

I have been trying to make a model for a game main screen.
(when you first open the game)
I have a background (painted on screen as a bitmap)
I have a button.
I have a button picture (for when the mouse is not over the button)
I have an inverted button picture (for when the mouse hovers over the button)

I have been looking around for an answer online but everything i find i don't understand at all.

With the code beneath i expected the picture to be painted above the button and when i pressed the button it would change to the inverted image but i failed.

Problem one:
I can't get the button picture to cover the actual press-able button on the screen.

Problem two:
I don't know how to paint while my mouse is hovering over the button.

Thank you for the help in advance and lets hope that i learn from this!
Here is the code that i have now:

// Datamembers

Bitmap *m_BmpBackgroundPtr, *m_BmpButtonNewGamePtr, *m_BmpButtonNewGameInvertedPtr;
Button *m_BtnNewgamePtr;

In the cpp section




// nothing to create

void MadThieves::GameStart()

m_BtnNewgamePtr = new Button("New Game");
m_BtnNewgamePtr->SetBounds(760, 400, 400, 50);
m_BtnNewgamePtr->SetFont("verdana", true, true, false, 18);

m_BmpBackgroundPtr = new Bitmap("Background.png");
m_BmpButtonNewGamePtr = new Bitmap("ButtonNewGame.png");
m_BmpButtonNewGameInvertedPtr = new Bitmap("ButtonNewGameInverted.png");

// Insert the code that needs to be executed at the start of the game

void MadThieves::GamePaint(RECT rect)


// Insert the code that needs to be executed each time a new frame needs to be drawn to the screen
// Technical note: engine uses double buffering when the gamecycle is running


void MadThieves::CallAction(Caller* callerPtr)

if(callerPtr == m_BtnNewgamePtr)

delete m_BmpButtonNewGamePtr;
m_BmpButtonNewGameInvertedPtr = new Bitmap("ButtonNewGameInverted.png");


// Insert the code that needs to be executed when a Caller has to perform an action
Topic archived. No new replies allowed.