1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| /**
* @brief Scanne les sorties graphiques disponibles
*/
void
SortieGraphique::scanner()
{
#if defined MACOSX
// recuperation de toutes les sorties graphiques disponibles
CGGetActiveDisplayList (32, s_sorties_graphiques, &s_nb_sorties_graphiques);
for (uint i = 0; i < s_nb_sorties_graphiques; ++i)
{
s_supporte_opengl[i] = (bool) CGDisplayUsesOpenGLAcceleration(s_sorties_graphiques[i]);
}
#elif defined WIN32
DISPLAY_DEVICE device;
device.cb = sizeof( device );
char deviceadaptername[33];
char deviceadapterstring[129];
uint total_sorties = 0;
uint num_dev = 0;
while (EnumDisplayDevices(0,num_dev,&device,0 ))
{
int i = 0;
sprintf(deviceadaptername, "%s%c",device.DeviceName,0);
sprintf(deviceadapterstring, "%s%c", device.DeviceString,0);
uint num_monitor = 0;
while( EnumDisplayDevices(deviceadaptername,num_monitor,&device,0 ) )
{
char deviceadapternamefull[33];
sprintf(deviceadapternamefull, "%s%c", device.DeviceName,0);
s_noms_sorties_graphiques[total_sorties].resize(33);
sprintf(&s_noms_sorties_graphiques[total_sorties][0],"%s%c",deviceadapternamefull,0);
s_noms_sorties_graphiques[total_sorties].push_back(0);
s_designations_sorties_graphiques[total_sorties].resize(129);
sprintf(&s_designations_sorties_graphiques[total_sorties][0],"%s%c",deviceadapterstring,0);
s_designations_sorties_graphiques[total_sorties].push_back(0);
s_ecrans[total_sorties].resize(129);
sprintf(&s_ecrans[total_sorties][0],"%s%c",device.DeviceString,0);
s_ecrans[total_sorties].push_back(0);
++total_sorties;
++num_monitor;
}
++num_dev;
}
s_nb_sorties_graphiques = total_sorties;
#endif
}
/**
* @brief Capture la sortie graphique
*/
void
SortieGraphique::capturer()
{
#if defined MACOSX
CGDisplayCapture (s_sorties_graphiques[m_num_sortie_graphique]);
CGRect rect = CGDisplayBounds (s_sorties_graphiques[m_num_sortie_graphique]);
m_largeur = rect.size.width;
m_hauteur = rect.size.height;
// hidecursor()
#elif defined WIN32
DEVMODE dm;
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
dm.dmSize = sizeof(DEVMODE);
dm.dmBitsPerPel = 24;
dm.dmFields = DM_BITSPERPEL;
ChangeDisplaySettingsEx(&s_noms_sorties_graphiques[m_num_sortie_graphique][0],&dm, 0, CDS_FULLSCREEN, 0);
SetWindowLong(s_plein_ecran, GWL_STYLE, WS_POPUP | WS_SYSMENU);
MoveWindow(s_plein_ecran,0,0,dm.dmPelsWidth,dm.dmPelsHeight,false);
ShowWindow(s_plein_ecran,SW_SHOW);
// ShowCursor(0);
#endif
} |
Partager