Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Custom Controls

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
No replies to this topic

#1 NLScotty   Members   

945
Like
0Likes
Like

Posted 13 September 2012 - 10:34 AM

Hello,

Recently I've started learning Direct2D. Now I wanted to start learning Direct2D to do a project which was not involving a game, but just a simple UI. So creating my own controls, this could become handy in the future and I think it's not as diffiuclt as a game.

Now my design of my control is like this:

struct MESSAGE_ID // so I can use 1 functions for the messages
{
    CLICKED,
    HIDDEN
}

struct DrawInfo // the draw structure, so I can draw the icon or something
{
     dword bitmapID;
     std::pair. ..
.....
}

class Control
{
public:
Control();

void SetSize(...)
void SetPos(...)

private:
std::pair possition;
std::pair size;


void OnMessage(MESSAGE_ID id); // call user setted function trhougha  void* pointer
}

class Button() : public Control
{
   
}

My idea is basically that a class holds all the info and returns a DrawInfo structure to the paiting class. And that a button for example is just a icon, which can change when someone clicked it or whatsoever. Is this the propper way of doing this?

Also, I draw my window in the WM_PAINT message and update it when a user does something or else in the WM_PAINT message to, is this also correct?

Grz,

Scotty




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.