I have small program here in which I am drawing some elements on the window.
class CustomPointer{
void draw(); //draw png image on the screen
};
class CustomRectangle{
void draw(){
drawRect(); //draw Rectangle with a certain color
drawbtnImage(); //draw png image to the top right of rectangle (alphaBlending enabled)
}
};
main.cpp
CustomRectangle customRectangle;
CustomPointer customPointer;
void draw(){
drawBackgroundImage();
customRectangle.draw();
customPointer.draw();
}
When I draw my elements using the above code, I was expecting the customPointer
to be drawn over all other elements on the screen since pointer is being drawn everything else. But my pointer is appearing over the background but goes behind the customRectangle/btnImage
.
How do I get my customPointer
to actually always remain over all other elements on the window?
Additionally, I was also expecting my btnImage.draw()
to be drawn over the custom shape (like a circular button at the top right of a control). The btnImage
is a png and has some transparency on its sides. However, instead of appearing over the rectangle, it is appearing behind it. Similar issue to fix. Any suggestions?