From: Nigel P. <ni...@in...> - 2002-05-01 02:12:09
|
> vector<video_modes> my_modes; > my_modes.push_back(...); > my_modes.push_back(...); > ... > VideoMonitors.push_bach(new Foo_monitor_desc(my_modes), ...); That sort of misses out filling in each video_mode structure, but yes, that is what I am currently using. It just seems strange to build up a list of modes just for the purpose of copying them into the base class's protected data space. > Couldn't be any easier. :-) Well, I was proposing: // for each display { Foo_monitor_desc *mon =3D new = Foo_monitor_desc(currentDepth(display), = displayId(display)); VideoMonitors.push_back(mon); int32 id=3D0x80; // for each mode of display { // if resolution differs from previous ++id; mon->add_mode(mode->x, mode->y, id, mode->bytes_per_row, mode->depth); } } That way, I don't need a static vector<video_mode>, nor a static void add_mode() to build it up. > You can even reuse the my_modes vector > if monitors support the same set of modes. One man's positive is another's negative, I guess :-) (In my case, I need to reset the vector for each monitor) -- |Nigel Pearson, ni...@in... |=93Now the world has gone to = bed,| |Telstra iDevelopments, Sydney Australia| Darkness won=92t engulf my = head,| | Office: 9206 3468 Fax: 9212 6329 | I can see by infrared, = | | Mobile: 0408 664435 Home: 9792 6998 | How I hate the night.=94 = -Marvin| |