website logo
Auteur
avatar
daddydav

Forum » » Développement » » [Résolu] - Compilation de ScreenModeReq.c


Post� : 30-01-2009 09:49 icone du post

Voilà ce que j'utilise pour demander un écran pour DW :



/****************************************************************/

static BOOL scrModeFilter( struct Hook *hook, s truct ScreenModeRequester *smr, ULONG modeID )
{
  ASSERT( hook );
  ASSERT( smr );
  struct DimensionInfo di;

  if( GetDisplayInfoData( NULL, (UBYTE*)&di,&nbs p;sizeof(struct DimensionInfo), DTAG_DIMS, modeID ) &g t;= (BYTE*)&di.Nominal.MaxY + 2 - (BYTE*)&di&n bsp;)
  {
     if( di.Nominal.MaxX+1 < ECR_W  || di.Nominal.MaxX-1 > ECR_W || di.Nominal.Ma xY+1 < ECR_H || di.Nominal.MaxY-1 > ECR_H&n bsp; || di.MaxDepth < DEPTH )
     return FALSE;
  }
  return TRUE;
}

/****************************************************************/

void demande_ecran(void)
{

  //**** declaration des variables

  struct ScreenModeRequester *req;
  struct Hook hook = { {NULL, NULL},& nbsp;(HOOKFUNC)HookEntry, (HOOKFUNC)scrModeFilter, 0 };
  struct DisplayInfo di;

  //**** ouverture ecran
  req = (struct ScreenModeRequester *) All ocAslRequestTags( ASL_ScreenModeRequest,
         ASLSM_FilterFunc,  (ULONG)&hook,
         ASLSM_TitleText, & nbsp;(ULONG)"Choix écran",
         TAG_END );

  if( AslRequest( req, NULL ) )
  {
    modeID = req->sm_DisplayID;
  }
  FreeAslRequest( req );

  if( GetDisplayInfoData( NULL, (UBYTE*)&di,&nbs p;sizeof(struct DisplayInfo), DTAG_DISP, modeID ) > = (BYTE*)&di.PropertyFlags + 4 - (BYTE*)&di&nb sp;)
  {
    if( di.PropertyFlags & DIPF_IS_FOR EIGN ) depth = 8;
  }

  if(modeID==INVALID_ID) quitp("Pas d'écran\n");

}

/****************************************************************/



ECR_W = est la largeur écran demandé
ECR_H = est la hauteur écran demandé
DEPTH = est la profondeur écran demandé (8/16/32 bits)

Cet article provient de Meta-MorphOS
https://www.meta-morphos.org/viewtopic.php?topic=125&forum=52