home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 51 / PCGamer51_17Demos.iso / games / CM / CyclingManagerDemoCangas.exe / CyclingManagerDemo / scripts / common / config / onglet_video.cnc < prev    next >
Text File  |  2001-06-05  |  29KB  |  933 lines

  1. var DeviceDesc oLogDevice;
  2.  
  3. func void LogDevice3D()
  4. {
  5.     var szx    szLine;
  6.     var i32x i,iNumDevices,ibfValidVideoMode;
  7.  
  8.     // Get available devices number api
  9.     iNumDevices = GetNumDevices();
  10.  
  11.                   szLine="******************************\n";
  12.     szLine=strcat(szLine,"*         3D DEVICES         *\n");
  13.     szLine=strcat(szLine,"******************************\n");
  14.     szLine=strcat(szLine,"D3DX devices number : ");
  15.     szLine=strcat(szLine,itoa(iNumDevices));
  16.     szLine=strcat(szLine,"\n\n");
  17.     print(szLine);
  18.  
  19.  
  20.     i=0;
  21.     while(i<iNumDevices)
  22.     {
  23.         GetDeviceDesc(i,oLogDevice);
  24.  
  25.         szLine="Device n░";
  26.         szLine=strcat(szLine,itoa(i));
  27.         szLine=strcat(szLine,":\n   ");
  28.         szLine=strcat(szLine,oLogDevice.szDesc);
  29.         szLine=strcat(szLine,"\n   Driver:");
  30.         szLine=strcat(szLine,oLogDevice.szDrv);
  31.         szLine=strcat(szLine,"\n   Desc:");
  32.         szLine=strcat(szLine,oLogDevice.szDrvDesc);
  33.         szLine=strcat(szLine,"\n");
  34.         print(szLine);
  35.  
  36.         i=i+1;
  37.     }
  38.  
  39.     // Default selected device
  40.     szLine="Default device : ";
  41.     szLine=strcat(szLine,itoa(GetDevice()));
  42.     szLine=strcat(szLine,"\n\n");
  43.     print(szLine);
  44.  
  45.     // Get available video mode from 3d device api on the default device
  46.     ibfValidVideoMode = GetValidVideoMode(oObject_DeviceListbox.m_iSelectedDevice);
  47.  
  48.  
  49.                   szLine="******************************\n";
  50.     szLine=strcat(szLine,"*         VIDEO MODE         *\n");
  51.     szLine=strcat(szLine,"******************************\n");
  52.  
  53.     if(ibfValidVideoMode & DLC_VidMod_640x480x16)
  54.     {
  55.         szLine=strcat(szLine,"   640x480x16\n");
  56.     }
  57.     if(ibfValidVideoMode & DLC_VidMod_640x480x32)
  58.     {
  59.         szLine=strcat(szLine,"   640x480x32\n");
  60.     }
  61.     if(ibfValidVideoMode & DLC_VidMod_800x600x16)
  62.     {
  63.         szLine=strcat(szLine,"   800x600x16\n");
  64.     }
  65.     if(ibfValidVideoMode & DLC_VidMod_800x600x32)
  66.     {
  67.         szLine=strcat(szLine,"   800x600x32\n");
  68.     }
  69.     if(ibfValidVideoMode & DLC_VidMod_1024x768x16)
  70.     {
  71.         szLine=strcat(szLine,"   1024x768x16\n");
  72.     }
  73.     if(ibfValidVideoMode & DLC_VidMod_1024x768x32)
  74.     {
  75.         szLine=strcat(szLine,"   1024x768x32\n");
  76.     }
  77.     if(ibfValidVideoMode & DLC_VidMod_1280x1024x16)
  78.     {
  79.         szLine=strcat(szLine,"   1280x1024x16\n");
  80.     }
  81.     if(ibfValidVideoMode & DLC_VidMod_1280x1024x32)
  82.     {
  83.         szLine=strcat(szLine,"   1280x1024x32\n");
  84.     }
  85.     if(ibfValidVideoMode & DLC_VidMod_1600x1200x16)
  86.     {
  87.         szLine=strcat(szLine,"   1600x1200x16\n");
  88.     }
  89.     if(ibfValidVideoMode & DLC_VidMod_1600x1200x32)
  90.     {
  91.         szLine=strcat(szLine,"   1600x1200x32\n");
  92.     }
  93.     print(szLine);
  94.  
  95.     // current video mode
  96.     szLine="Current video mode : ";
  97.     szLine=strcat(szLine,itoa(GetVideoMode()));
  98.     szLine=strcat(szLine,"\n");
  99.     print(szLine);
  100. }
  101.  
  102.  
  103. func void Init_VideoMode_List ()
  104. {
  105.     var i32x i,iVideoMode,ibfValidVideoMode;
  106.  
  107.     // Get available video mode from 3d device api
  108.     ibfValidVideoMode = GetValidVideoMode(oObject_DeviceListbox.m_iSelectedDevice);
  109.  
  110.     // Fill Video Mode Array
  111.     i=0;
  112.     if(ibfValidVideoMode & DLC_VidMod_640x480x16)
  113.     {
  114.         oVideoModes.iVideoMode[i] = DLC_VidMod_640x480x16;
  115.         // MistER-j WARNING LOCALIZED
  116.         oVideoModes.szVideoModeDesc[i] = "640x480x16";
  117.         i=i+1;
  118.     }
  119.     if(ibfValidVideoMode & DLC_VidMod_640x480x32)
  120.     {
  121.         oVideoModes.iVideoMode[i] = DLC_VidMod_640x480x32;
  122.         // MistER-j WARNING LOCALIZED
  123.         oVideoModes.szVideoModeDesc[i] = "640x480x32";
  124.         i=i+1;
  125.     }
  126.     if(ibfValidVideoMode & DLC_VidMod_800x600x16)
  127.     {
  128.         oVideoModes.iVideoMode[i] = DLC_VidMod_800x600x16;
  129.         // MistER-j WARNING LOCALIZED
  130.         oVideoModes.szVideoModeDesc[i] = "800x600x16";
  131.         i=i+1;
  132.     }
  133.     if(ibfValidVideoMode & DLC_VidMod_800x600x32)
  134.     {
  135.         oVideoModes.iVideoMode[i] = DLC_VidMod_800x600x32;
  136.         // MistER-j WARNING LOCALIZED
  137.         oVideoModes.szVideoModeDesc[i] = "800x600x32";
  138.         i=i+1;
  139.     }
  140.     if(ibfValidVideoMode & DLC_VidMod_1024x768x16)
  141.     {
  142.         oVideoModes.iVideoMode[i] = DLC_VidMod_1024x768x16;
  143.         // MistER-j WARNING LOCALIZED
  144.         oVideoModes.szVideoModeDesc[i] = "1024x768x16";
  145.         i=i+1;
  146.     }
  147.     if(ibfValidVideoMode & DLC_VidMod_1024x768x32)
  148.     {
  149.         oVideoModes.iVideoMode[i] = DLC_VidMod_1024x768x32;
  150.         // MistER-j WARNING LOCALIZED
  151.         oVideoModes.szVideoModeDesc[i] = "1024x768x32";
  152.         i=i+1;
  153.     }
  154.     if(ibfValidVideoMode & DLC_VidMod_1280x1024x16)
  155.     {
  156.         oVideoModes.iVideoMode[i] = DLC_VidMod_1280x1024x16;
  157.         // MistER-j WARNING LOCALIZED
  158.         oVideoModes.szVideoModeDesc[i] = "1280x1024x16";
  159.         i=i+1;
  160.     }
  161.     if(ibfValidVideoMode & DLC_VidMod_1280x1024x32)
  162.     {
  163.         oVideoModes.iVideoMode[i] = DLC_VidMod_1280x1024x32;
  164.         // MistER-j WARNING LOCALIZED
  165.         oVideoModes.szVideoModeDesc[i] = "1280x1024x32";
  166.         i=i+1;
  167.     }
  168.     if(ibfValidVideoMode & DLC_VidMod_1600x1200x16)
  169.     {
  170.         oVideoModes.iVideoMode[i] = DLC_VidMod_1600x1200x16;
  171.         // MistER-j WARNING LOCALIZED
  172.         oVideoModes.szVideoModeDesc[i] = "1600x1200x16";
  173.         i=i+1;
  174.     }
  175.     if(ibfValidVideoMode & DLC_VidMod_1600x1200x32)
  176.     {
  177.         oVideoModes.iVideoMode[i] = DLC_VidMod_1600x1200x32;
  178.         // MistER-j WARNING LOCALIZED
  179.         oVideoModes.szVideoModeDesc[i] = "1600x1200x32";
  180.         i=i+1;
  181.     }
  182.  
  183.     // Num Available video mode
  184.     oVideoModes.iNbVideoMode = i;
  185.  
  186.     //    Get Current video Mode
  187.     iVideoMode = GetVideoMode();
  188.     
  189.     oObject_VideoModeListbox.m_iSelectedVideoMode = 0;
  190.     i=0;
  191.     while(i<10)
  192.     {
  193.         if(iVideoMode == oVideoModes.iVideoMode[i])
  194.         {
  195.             oObject_VideoModeListbox.m_iSelectedVideoMode = i;
  196.         }
  197.         i=i+1;
  198.     }
  199. }
  200.  
  201. //----------------------------------------------------------------------------------------------------------------//
  202. //----------------------------------------------------------------------------------------------------------------//
  203. //
  204. //----------------------------------------------------------------------------------------------------------------//
  205. //----------------------------------------------------------------------------------------------------------------//
  206. func void VideoMode_List_Item_Create ()
  207. {
  208.     SetObjectMembersNumber(1);
  209.     SetComponentNumber(2);
  210.     
  211.     // selection
  212.     oVideoMode_List_Item.iSelectionID = InitContainer(t_Common_Color_White);
  213.     SetContainerColor(oVideoMode_List_Item.iSelectionID,c_ListSelection);
  214.     SetContainerSize(oVideoMode_List_Item.iSelectionID, 150, 16);
  215.     SetComponentClipper(oVideoMode_List_Item.iSelectionID, 0, 0, 150, 16);
  216.     SetComponentVisibleStatus(oVideoMode_List_Item.iSelectionID,false);
  217.  
  218.     // video mode name
  219.     oVideoMode_List_Item.iVideoModeNameID = InitContainer(tFontArial);
  220.     SetContainerText(oVideoMode_List_Item.iVideoModeNameID,g_szNull);
  221.     SetComponentSize(oVideoMode_List_Item.iVideoModeNameID,150,16);
  222.  
  223.     // Change item size
  224.     SetObjectSize(150,16);
  225. }
  226.  
  227. //----------------------------------------------------------------------------------------------------------------//
  228. //----------------------------------------------------------------------------------------------------------------//
  229. //
  230. //----------------------------------------------------------------------------------------------------------------//
  231. //----------------------------------------------------------------------------------------------------------------//
  232. func void VideoMode_List_Item_Update (i32x _iItemIndex)
  233. {
  234.     // Store item index into object
  235.     Seti32x(0,_iItemIndex);
  236.  
  237.     // Update container text
  238.     SetContainerText(oVideoMode_List_Item.iVideoModeNameID,oVideoModes.szVideoModeDesc[_iItemIndex]);
  239. }
  240.  
  241. func i32x VideoMode_List_Item_Event (i32x _iComponentID, i32x _iEvent)
  242. {
  243.     if (_iComponentID == -1)
  244.     {
  245.         if (_iEvent == GUI_COMPONENT_MOUSE_LEAVE)
  246.         {
  247.             SetComponentVisibleStatus(oVideoMode_List_Item.iSelectionID, 0);
  248.         }
  249.         if (_iEvent == GUI_COMPONENT_MOUSE_ENTER)
  250.         {
  251.             SetComponentVisibleStatus(oVideoMode_List_Item.iSelectionID, 1);
  252.         }
  253.  
  254.         if (_iEvent == GUI_LIST_SELECTITEM)
  255.         {
  256.             // Save selected item as selected video mode
  257.             oObject_VideoModeListbox.m_iSelectedVideoMode = Geti32x(0);
  258.         }
  259.     }
  260.     
  261.     if (_iEvent == GUI_COMPONENT_MOUSE_LDOWN)
  262.     {
  263.         if (_iComponentID != oVideoMode_List_Item.iSelectionID)
  264.         {
  265.             PlaySound(0,sbClickSound[0]);
  266.             PushEvent(GUI_LIST_SELECTION);
  267.         }
  268.     }
  269.  
  270.     return 1;
  271. }
  272. // *** Video Mode List box ***
  273. func void Object_VideoModeListbox_Update ()
  274. {
  275.     var szx szTemp;
  276.  
  277.     // Get server name
  278.     szTemp = oVideoModes.szVideoModeDesc[oObject_VideoModeListbox.m_iSelectedVideoMode];
  279.  
  280.     // Update text container
  281.     SetContainerText(oObject_VideoModeListbox.m_cText,szTemp);
  282. }
  283.  
  284.  
  285. func void Object_VideoModeListbox_CreateList (i32x _iX, i32x _iY)
  286. {
  287.     var i32x id;
  288.     
  289.     var i32x iSizeX;
  290.  
  291.     iSizeX = GetComponentWidth(oObject_VideoModeListbox.m_cBack);
  292.  
  293.     id = Init_LibObject_FilledCadre(t_fcadre_listbox,iSizeX,120);
  294.     oObject_VideoModeListbox.m_cListBack = id;
  295.     SetComponentPosition(id,_iX,_iY);
  296.  
  297.     // Init Stage List
  298.     if(oObject_VideoModeListbox.m_cList == ID_NOT_CREATED)
  299.     {
  300.         oObject_VideoModeListbox.m_cList = InitList("Server List",
  301.             20,
  302.             iSizeX-12,110,
  303.             VideoMode_List_Item_Create,VideoMode_List_Item_Update,VideoMode_List_Item_Event,
  304.             t_btn_slider,
  305.             NullButtonState
  306.         );
  307.         SetComponentPosition(oObject_VideoModeListbox.m_cList,_iX+8,_iY+10);
  308.     }
  309.     AutoResize();
  310.     SetListNbItems(oObject_VideoModeListbox.m_cList,oVideoModes.iNbVideoMode);
  311. }
  312.  
  313. //Object_VideoModeListbox Create func
  314. //----------------------------------------------------------------------------------------------------------------//
  315. func void Object_VideoModeListbox_Create ()
  316. {
  317.     SetComponentNumber(10);
  318.  
  319.     var i32x id;
  320.     var i32x x;
  321.  
  322.     // No list by default
  323.     oObject_VideoModeListbox.m_cList = ID_NOT_CREATED;
  324.  
  325.     // Width of list box
  326.     x = 200;
  327.  
  328.     // Background
  329.     id = Init_LibObject_FilledCadre(t_fcadre_listbox,x,30);
  330.     oObject_VideoModeListbox.m_cBack = id;
  331.  
  332.     // Text
  333.     id =InitContainer(tFontArial);
  334.     SetComponentPosition(id, 10, 8);
  335.     SetContainerText(id,g_szNull);
  336.     oObject_VideoModeListbox.m_cText=id;
  337.  
  338.     // arrow
  339.     id = InitButton(t_arrow_down);
  340.     oObject_VideoModeListbox.m_cArrow=id;
  341.     SetContainerStateFunc(id,ThreeStateButtonState);
  342.     SetComponentPosition(id,x-22,5);
  343.     
  344.     // first display update
  345.     Object_VideoModeListbox_Update();
  346.     // resize the List box
  347.     AutoResize();
  348. }
  349. //Object_VideoModeListbox Event func
  350. //----------------------------------------------------------------------------------------------------------------//
  351. func i32x Object_VideoModeListbox_Event (i32x _iComponentID, i32x _iEvent)
  352. {
  353.     if (_iComponentID == oObject_VideoModeListbox.m_cList)
  354.     {
  355.         // The video settings need to be changed
  356.         oDialog_Configuration.m_bChangeVideo = true;
  357.  
  358.         if(_iEvent == GUI_LIST_SELECTION )
  359.         {
  360.             oDialog_Configuration.m_iNeedSave = true;
  361.             Object_VideoModeListbox_Update();
  362.             DeleteComponent(oObject_VideoModeListbox.m_cList);
  363.             DeleteComponent(oObject_VideoModeListbox.m_cListBack);
  364.  
  365.             oObject_VideoModeListbox.m_cList=ID_NOT_CREATED;
  366.             oObject_VideoModeListbox.m_cListBack=ID_NOT_CREATED;
  367.  
  368.             AutoResize();
  369.  
  370.             PushEvent(GUI_COMPONENT_REFRESH);
  371.         }
  372.     }
  373.  
  374.     if (_iComponentID == oObject_VideoModeListbox.m_cArrow)
  375.     {
  376.         if(_iEvent == GUI_BUTTON_PRESSED )
  377.         {
  378.             PlaySound(0,sbClickSound[0]);
  379.  
  380.             if(oObject_VideoModeListbox.m_cList == ID_NOT_CREATED)
  381.             {
  382.                 var i32x y;
  383.  
  384.                 // Get text height
  385.                 y = GetComponentHeight(oObject_VideoModeListbox.m_cBack);
  386.  
  387.                 // Create the list under the text
  388.                 Object_VideoModeListbox_CreateList(0,y);
  389.             }
  390.             else
  391.             {
  392.                 DeleteComponent(oObject_VideoModeListbox.m_cList);
  393.                 DeleteComponent(oObject_VideoModeListbox.m_cListBack);
  394.  
  395.                 oObject_VideoModeListbox.m_cList=ID_NOT_CREATED;
  396.                 oObject_VideoModeListbox.m_cListBack=ID_NOT_CREATED;
  397.  
  398.                 // Restore size
  399.                 AutoResize();
  400.             }
  401.         }
  402.     }
  403.  
  404.     return 1;
  405. }
  406.  
  407. //Object_VideoModeListbox Init member
  408. //----------------------------------------------------------------------------------------------------------------//
  409. func void Object_VideoModeListbox_InitMembers ()
  410. {
  411.     oObject_VideoModeListbox.m_szName        = "Object_VideoModeListbox";
  412.     oObject_VideoModeListbox.oFunc.pcreate    = Object_VideoModeListbox_Create;
  413.     oObject_VideoModeListbox.oFunc.pevent    = Object_VideoModeListbox_Event;
  414. }
  415.  
  416. // **************************************************************
  417. // Device list box
  418. // **************************************************************
  419. func void Init_Device_List ()
  420. {
  421.     var i32x i,iNumDevices;
  422.  
  423.     // Get available devices number api
  424.     iNumDevices = GetNumDevices();
  425.     if(iNumDevices>16)
  426.         iNumDevices = 16;
  427.  
  428.     // Fill device Mode Array
  429.     i=0;
  430.     while(i<iNumDevices)
  431.     {
  432.         GetDeviceDesc(i,oDevices.m_oDevice[i]);
  433.         i=i+1;
  434.     }
  435.  
  436.     // Device number
  437.     oDevices.iNbDevices = iNumDevices;
  438.     // Default selected device
  439.     oObject_DeviceListbox.m_iSelectedDevice = GetDevice();
  440. }
  441.  
  442. //----------------------------------------------------------------------------------------------------------------//
  443. //----------------------------------------------------------------------------------------------------------------//
  444. //
  445. //----------------------------------------------------------------------------------------------------------------//
  446. //----------------------------------------------------------------------------------------------------------------//
  447. func void Device_List_Item_Create ()
  448. {
  449.     SetObjectMembersNumber(1);
  450.     SetComponentNumber(3);
  451.     
  452.     // selection
  453.     oDevice_List_Item.iSelectionID = InitContainer(t_Common_Color_White);
  454.     SetContainerColor(oDevice_List_Item.iSelectionID,c_ListSelection);
  455.     SetContainerSize(oDevice_List_Item.iSelectionID, 300, 64);
  456.     SetComponentClipper(oDevice_List_Item.iSelectionID, 0, 0, 300, 64);
  457.     SetComponentVisibleStatus(oDevice_List_Item.iSelectionID,false);
  458.  
  459.     // Device name
  460.     oDevice_List_Item.iDeviceNameID = InitContainer(tFontArial);
  461.     SetContainerOffset(oDevice_List_Item.iDeviceNameID,-1);
  462.     SetComponentSize(oDevice_List_Item.iDeviceNameID,300,80);
  463.     SetContainerText(oDevice_List_Item.iDeviceNameID,g_szNull);
  464.     SetComponentPosition(oDevice_List_Item.iDeviceNameID,0,16);
  465.  
  466.     // Driver name
  467.     oDevice_List_Item.iDriverDescID = InitContainer(tFontArialItalique);
  468.     SetComponentSize(oDevice_List_Item.iDriverDescID,300,48);
  469.     SetContainerText(oDevice_List_Item.iDriverDescID,g_szNull);
  470.  
  471.     // Change item size
  472.     SetObjectSize(300,64);
  473. }
  474.  
  475. //----------------------------------------------------------------------------------------------------------------//
  476. //----------------------------------------------------------------------------------------------------------------//
  477. //
  478. //----------------------------------------------------------------------------------------------------------------//
  479. //----------------------------------------------------------------------------------------------------------------//
  480. func void Device_List_Item_Update (i32x _iItemIndex)
  481. {
  482.     var szx szDriverDesc;
  483.     // Store item index into object
  484.     Seti32x(0,_iItemIndex);
  485.  
  486.     // Update container text
  487.     SetContainerTextJustify(oDevice_List_Item.iDeviceNameID,oDevices.m_oDevice[_iItemIndex].szDesc);
  488.  
  489.     szDriverDesc = oDevices.m_oDevice[_iItemIndex].szDrvDesc;
  490.     szDriverDesc = strcat(szDriverDesc," ");
  491.     szDriverDesc = strcat(szDriverDesc,oDevices.m_oDevice[_iItemIndex].szDrv);
  492.  
  493.     SetContainerText(oDevice_List_Item.iDriverDescID,szDriverDesc);
  494. }
  495.  
  496. func i32x Device_List_Item_Event (i32x _iComponentID, i32x _iEvent)
  497. {
  498.     if (_iComponentID == -1)
  499.     {
  500.         if (_iEvent == GUI_COMPONENT_MOUSE_LEAVE)
  501.         {
  502.             SetComponentVisibleStatus(oDevice_List_Item.iSelectionID, 0);
  503.         }
  504.         if (_iEvent == GUI_COMPONENT_MOUSE_ENTER)
  505.         {
  506.             SetComponentVisibleStatus(oDevice_List_Item.iSelectionID, 1);
  507.         }
  508.  
  509.         if (_iEvent == GUI_LIST_UNSELECTITEM)
  510.         {
  511.             SetComponentVisibleStatus(oDevice_List_Item.iSelectionID, false);
  512.         }
  513.  
  514.         if (_iEvent == GUI_LIST_SELECTITEM)
  515.         {
  516.             // Save selected item as selected device
  517.             oObject_DeviceListbox.m_iSelectedDevice = Geti32x(0);
  518.  
  519.             // Update video mode list
  520.             Init_VideoMode_List();
  521.  
  522.             SetComponentVisibleStatus(oDevice_List_Item.iSelectionID, true);
  523.         }
  524.     }
  525.     
  526.     if (_iEvent == GUI_COMPONENT_MOUSE_LDOWN)
  527.     {
  528.         if (_iComponentID != oDevice_List_Item.iSelectionID)
  529.         {
  530.             // The video settings need to be changed
  531.             oDialog_Configuration.m_bChangeVideo = true;
  532.  
  533.             PlaySound(0,sbClickSound[0]);
  534.             PushEvent(GUI_LIST_SELECTION);
  535.         }
  536.     }
  537.  
  538.     return 1;
  539. }
  540. // *** Device List box ***
  541. func void Object_DeviceListbox_Update ()
  542. {
  543.     var szx szTemp;
  544.  
  545.     // Get device name
  546.     szTemp = oDevices.m_oDevice[oObject_DeviceListbox.m_iSelectedDevice].szDesc;
  547.  
  548.     // Update text container
  549.     SetContainerTextJustify(oObject_DeviceListbox.m_cText,szTemp);
  550. }
  551.  
  552.  
  553. func void Object_DeviceListbox_CreateList (i32x _iX, i32x _iY)
  554. {
  555.     var i32x id;
  556.     
  557.     var i32x iSizeX;
  558.  
  559.     iSizeX = GetComponentWidth(oObject_DeviceListbox.m_cBack);
  560.  
  561.     id = Init_LibObject_FilledCadre(t_fcadre_listbox,iSizeX,246);
  562.     oObject_DeviceListbox.m_cListBack = id;
  563.     SetComponentPosition(id,_iX,_iY);
  564.  
  565.     // Init Stage List
  566.     if(oObject_DeviceListbox.m_cList == ID_NOT_CREATED)
  567.     {
  568.         oObject_DeviceListbox.m_cList = InitList("Device List",
  569.             20,
  570.             iSizeX-12,236,
  571.             Device_List_Item_Create,Device_List_Item_Update,Device_List_Item_Event,
  572.             t_btn_slider,
  573.             NullButtonState
  574.         );
  575.         SetComponentPosition(oObject_DeviceListbox.m_cList,_iX+8,_iY+10);
  576.     }
  577.     AutoResize();
  578.     SetListNbItems(oObject_DeviceListbox.m_cList,oDevices.iNbDevices);
  579. }
  580.  
  581. //Object_DeviceListbox_Create func
  582. //----------------------------------------------------------------------------------------------------------------//
  583. func void Object_DeviceListbox_Create ()
  584. {
  585.     SetComponentNumber(10);
  586.  
  587.     var i32x id;
  588.     var i32x x;
  589.  
  590.     // No list by default
  591.     oObject_DeviceListbox.m_cList = ID_NOT_CREATED;
  592.  
  593.     // Width of list box
  594.     x = 350;
  595.  
  596.     // Background
  597.     id = Init_LibObject_FilledCadre(t_fcadre_listbox,x,50);
  598.     oObject_DeviceListbox.m_cBack = id;
  599.  
  600.     // Text
  601.     id =InitContainer(tFontArial);
  602.     SetComponentSize(id,320,48);
  603.     SetContainerOffset(id,-1);
  604.     SetComponentPosition(id, 10, 8);
  605.     SetContainerText(id,g_szNull);
  606.     SetComponentClipper(id,0, 0, 320, 48);
  607.     oObject_DeviceListbox.m_cText=id;
  608.  
  609.     // arrow
  610.     id = InitButton(t_arrow_down);
  611.     oObject_DeviceListbox.m_cArrow=id;
  612.     SetContainerStateFunc(id,ThreeStateButtonState);
  613.     SetComponentPosition(id,x-22,5);
  614.     
  615.     // first display update
  616.     Object_DeviceListbox_Update();
  617.     // resize the List box
  618.     AutoResize();
  619. }
  620. //Object_DeviceListbox Event func
  621. //----------------------------------------------------------------------------------------------------------------//
  622. func i32x Object_DeviceListbox_Event (i32x _iComponentID, i32x _iEvent)
  623. {
  624.     if (_iComponentID == oObject_DeviceListbox.m_cList)
  625.     {
  626.  
  627.         if(_iEvent == GUI_LIST_SELECTION )
  628.         {
  629.             oDialog_Configuration.m_iNeedSave = true;
  630.  
  631.             Object_DeviceListbox_Update();
  632.  
  633.             DeleteComponent(oObject_DeviceListbox.m_cList);
  634.             DeleteComponent(oObject_DeviceListbox.m_cListBack);
  635.  
  636.             oObject_DeviceListbox.m_cList=ID_NOT_CREATED;
  637.             oObject_DeviceListbox.m_cListBack=ID_NOT_CREATED;
  638.  
  639.             AutoResize();
  640.  
  641.             PushEvent(GUI_COMPONENT_REFRESH);
  642.         }
  643.     }
  644.  
  645.     if (_iComponentID == oObject_DeviceListbox.m_cArrow)
  646.     {
  647.         if(_iEvent == GUI_BUTTON_PRESSED )
  648.         {
  649.             PlaySound(0,sbClickSound[0]);
  650.  
  651.             if(oObject_DeviceListbox.m_cList == ID_NOT_CREATED)
  652.             {
  653.                 var i32x y;
  654.  
  655.                 // Get text height
  656.                 y = GetComponentHeight(oObject_DeviceListbox.m_cBack);
  657.  
  658.                 // Create the list under the text
  659.                 Object_DeviceListbox_CreateList(0,y);
  660.             }
  661.             else
  662.             {
  663.                 DeleteComponent(oObject_DeviceListbox.m_cList);
  664.                 DeleteComponent(oObject_DeviceListbox.m_cListBack);
  665.  
  666.                 oObject_DeviceListbox.m_cList=ID_NOT_CREATED;
  667.                 oObject_DeviceListbox.m_cListBack=ID_NOT_CREATED;
  668.  
  669.                 // Restore size
  670.                 AutoResize();
  671.             }
  672.         }
  673.     }
  674.  
  675.     return 1;
  676. }
  677.  
  678. //Object_DeviceListbox Init member
  679. //----------------------------------------------------------------------------------------------------------------//
  680. func void Object_DeviceListbox_InitMembers ()
  681. {
  682.     oObject_DeviceListbox.m_szName        = "oObject_DeviceListbox";
  683.     oObject_DeviceListbox.oFunc.pcreate    = Object_DeviceListbox_Create;
  684.     oObject_DeviceListbox.oFunc.pevent    = Object_DeviceListbox_Event;
  685. }
  686.  
  687. //----------------------------------------------------------------------------------------------------------------//
  688. //----------------------------------------------------------------------------------------------------------------//
  689. //Onglet video Create
  690. //----------------------------------------------------------------------------------------------------------------//
  691. //----------------------------------------------------------------------------------------------------------------//
  692. func void Onglet_video_Create ()
  693. {
  694.     var i32x i,id;
  695.  
  696.     // Dialog component number
  697.     SetComponentNumber(32);
  698.  
  699.     // Fill Device Array with available videoMode
  700.     Init_Device_List();
  701.     // Fill Video mode Array with available videoMode
  702.     Init_VideoMode_List();
  703.     
  704.     // Resize dialog
  705.     SetObjectSize(690,450);
  706.  
  707.  
  708.     // Texture bitdepth RB
  709.     id = InitContainer(tFontArialItalique);
  710.     SetComponentPosition(id, 10, 150);
  711.     SetContainerText(id, GetLocalizedFromGMKey(287));
  712.  
  713.     oOnglet_video.m_c16Bits = Init_LibObject_MultiRadioButtonWithText(tButton32Multi,6,GetLocalizedFromGMKey(288),tFontArial,0);
  714.     oOnglet_video.m_c32Bits = Init_LibObject_MultiRadioButtonWithText(tButton32Multi,6,GetLocalizedFromGMKey(289),tFontArial,0);
  715.  
  716.     SetTextButtonStateFunc(oOnglet_video.m_c16Bits,CheckBoxMultiState,MultiRadioButtonWithText_TextState);
  717.     SetTextButtonStateFunc(oOnglet_video.m_c32Bits,CheckBoxMultiState,MultiRadioButtonWithText_TextState);
  718.  
  719.     SetComponentPosition(oOnglet_video.m_c16Bits, 200, 150);
  720.     SetComponentPosition(oOnglet_video.m_c32Bits, 360, 150);
  721.  
  722.     // Double or triple buffering
  723.     id = InitContainer(tFontArialItalique);
  724.     SetComponentPosition(id, 10, 100);
  725.     SetContainerText(id, GetLocalizedFromGMKey(402));
  726.  
  727.     oOnglet_video.m_cDoubleBuffering  = Init_LibObject_MultiRadioButtonWithText(tButton32Multi,6,GetLocalizedFromGMKey(403),tFontArial,0);
  728.     SetTextButtonStateFunc(oOnglet_video.m_cDoubleBuffering,CheckBoxMultiState,MultiRadioButtonWithText_TextState);
  729.     SetComponentPosition(oOnglet_video.m_cDoubleBuffering, 200, 100);
  730.  
  731.     oOnglet_video.m_cTripleBuffering  = Init_LibObject_MultiRadioButtonWithText(tButton32Multi,6,GetLocalizedFromGMKey(404),tFontArial,0);
  732.     SetTextButtonStateFunc(oOnglet_video.m_cTripleBuffering,CheckBoxMultiState,MultiRadioButtonWithText_TextState);
  733.     SetComponentPosition(oOnglet_video.m_cTripleBuffering, 360, 100);
  734.  
  735.     print(itoa(IsTripleBuffering()));
  736.     if (IsTripleBuffering())
  737.     {
  738.         oOnglet_video.m_bTripleBuffer = true;
  739.         SetTextRadioButtonCheckBox(oOnglet_video.m_cTripleBuffering, 1);
  740.     }
  741.     else
  742.     {
  743.         oOnglet_video.m_bTripleBuffer = false;
  744.         SetTextRadioButtonCheckBox(oOnglet_video.m_cDoubleBuffering, 1);
  745.     }
  746.  
  747.  
  748.     // Default texture bit depth
  749.     if (GetTexBitDepth() == 32)
  750.     {
  751.         oOnglet_video.m_iTextureBitDepth = 32;
  752.         SetTextRadioButtonCheckBox(oOnglet_video.m_c32Bits, 1);
  753.         SetTextRadioButtonCheckBox(oOnglet_video.m_c16Bits, 0);
  754.     }
  755.     else
  756.     {
  757.         oOnglet_video.m_iTextureBitDepth = 16;
  758.         SetTextRadioButtonCheckBox(oOnglet_video.m_c32Bits, 0);
  759.         SetTextRadioButtonCheckBox(oOnglet_video.m_c16Bits, 1);
  760.     }
  761.  
  762.     // Cyclist LOD
  763.     id = InitContainer(tFontArialItalique);
  764.     SetComponentPosition(id, 10, 200);
  765.     SetContainerText(id, GetLocalizedFromGMKey(410));
  766.     SetContainerOffset(id,-1);
  767.     oOnglet_video.m_iCyclistLOD = GetCyclistLOD();
  768.     i=0;
  769.     while(i<4)
  770.     {
  771.         oOnglet_video.m_cCyclistLOD[i] = Init_LibObject_MultiRadioButtonWithText(tButton32Multi,4,GetLocalizedFromGMKey(406+i),tFontArial,0);
  772.         SetTextButtonStateFunc(oOnglet_video.m_cCyclistLOD[i],CheckBoxMultiState,MultiRadioButtonWithText_TextState);
  773.         SetComponentPosition(oOnglet_video.m_cCyclistLOD[i], 200+112*i, 200);
  774.  
  775.         if(i==oOnglet_video.m_iCyclistLOD)
  776.         {
  777.             SetTextRadioButtonCheckBox(oOnglet_video.m_cCyclistLOD[i], 1);
  778.         }
  779.         i=i+1;
  780.     }
  781.     // Texture LOD
  782.     id = InitContainer(tFontArialItalique);
  783.     SetComponentPosition(id, 10, 250);
  784.     SetContainerText(id, GetLocalizedFromGMKey(411));
  785.     SetContainerOffset(id,-1);
  786.     oOnglet_video.m_iTextureLOD = GetTextureLOD();
  787.     i=0;
  788.     while(i<2)
  789.     {
  790.         oOnglet_video.m_cTextureLOD[i] = Init_LibObject_MultiRadioButtonWithText(tButton32Multi,4,GetLocalizedFromGMKey(406+(2*i)),tFontArial,0);
  791.         SetTextButtonStateFunc(oOnglet_video.m_cTextureLOD[i],CheckBoxMultiState,MultiRadioButtonWithText_TextState);
  792.         SetComponentPosition(oOnglet_video.m_cTextureLOD[i], 200+112*i, 250);
  793.  
  794.         if(i==oOnglet_video.m_iTextureLOD)
  795.         {
  796.             SetTextRadioButtonCheckBox(oOnglet_video.m_cTextureLOD[i], 1);
  797.         }
  798.         i=i+1;
  799.     }
  800.  
  801.     // Video Mode list box
  802.     id = InitContainer(tFontArialItalique);
  803.     SetComponentPosition(id, 400, 0);
  804.     SetContainerText(id, GetLocalizedFromGMKey(124));
  805.  
  806.     Object_VideoModeListbox_InitMembers();
  807.     oOnglet_video.m_cVideoModeListBox = InitObject(
  808.         oObject_VideoModeListbox.m_szName,        // Object Name
  809.         oObject_VideoModeListbox.oFunc.pcreate,    // Create func
  810.         oObject_VideoModeListbox.oFunc.pevent    // Event func
  811.     );
  812.     SetComponentPosition(oOnglet_video.m_cVideoModeListBox, 400, 20);
  813.  
  814.     // Device Mode list box
  815.     id = InitContainer(tFontArialItalique);
  816.     SetComponentPosition(id, 10, 0);
  817.     SetContainerText(id, GetLocalizedFromGMKey(123));
  818.  
  819.     Object_DeviceListbox_InitMembers();
  820.     oOnglet_video.m_cDeviceListBox = InitObject(
  821.         oObject_DeviceListbox.m_szName,        // Object Name
  822.         oObject_DeviceListbox.oFunc.pcreate,    // Create func
  823.         oObject_DeviceListbox.oFunc.pevent    // Event func
  824.     );
  825.     SetComponentPosition(oOnglet_video.m_cDeviceListBox, 10, 20);
  826.  
  827. }
  828.  
  829.  
  830.  
  831. func i32x Onglet_video_Event (i32x _iComponentID, i32x _iEvent)
  832. {
  833.     var i32x i,index;
  834.     if(_iEvent == GUI_RADIOBUTTON_CHANGED)
  835.     {
  836.         PlaySound(0,sbClickSound[0]);
  837.  
  838.         // The video settings need to be changed
  839.         oDialog_Configuration.m_bChangeVideo = true;
  840.  
  841.         //Need to save new settings
  842.         oDialog_Configuration.m_iNeedSave = true;
  843.  
  844.         if (_iComponentID == oOnglet_video.m_c16Bits)
  845.         {
  846.             oOnglet_video.m_iTextureBitDepth = 16;
  847.             SetTextRadioButtonCheckBox(oOnglet_video.m_c32Bits,0);
  848.         }
  849.         else if (_iComponentID == oOnglet_video.m_c32Bits)
  850.         {
  851.             oOnglet_video.m_iTextureBitDepth = 32;
  852.             SetTextRadioButtonCheckBox(oOnglet_video.m_c16Bits,0);
  853.         }
  854.         else if (_iComponentID == oOnglet_video.m_cDoubleBuffering)
  855.         {
  856.             oOnglet_video.m_bTripleBuffer = false;
  857.             SetTextRadioButtonCheckBox(oOnglet_video.m_cTripleBuffering,0);
  858.         }
  859.         else if (_iComponentID == oOnglet_video.m_cTripleBuffering)
  860.         {
  861.             oOnglet_video.m_bTripleBuffer = true;
  862.             SetTextRadioButtonCheckBox(oOnglet_video.m_cDoubleBuffering,0);
  863.         }
  864.         else if ((_iComponentID >= oOnglet_video.m_cCyclistLOD[0])&&(_iComponentID <= oOnglet_video.m_cCyclistLOD[3]))
  865.         {
  866.             index = _iComponentID - oOnglet_video.m_cCyclistLOD[0];
  867.  
  868.             i=0;
  869.             while(i<4)
  870.             {
  871.                 if(i != index)
  872.                     SetTextRadioButtonCheckBox(oOnglet_video.m_cCyclistLOD[i],0);
  873.  
  874.                 i=i+1;
  875.             }
  876.             oOnglet_video.m_iCyclistLOD = index;
  877.         }
  878.         else if ((_iComponentID >= oOnglet_video.m_cTextureLOD[0])&&(_iComponentID <= oOnglet_video.m_cTextureLOD[1]))
  879.         {
  880.             index = _iComponentID - oOnglet_video.m_cTextureLOD[0];
  881.  
  882.             i=0;
  883.             while(i<2)
  884.             {
  885.                 if(i != index)
  886.                     SetTextRadioButtonCheckBox(oOnglet_video.m_cTextureLOD[i],0);
  887.  
  888.                 i=i+1;
  889.             }
  890.             oOnglet_video.m_iTextureLOD = index;
  891.         }
  892.     }
  893.  
  894.     return 1;
  895. }
  896.  
  897. //----------------------------------------------------------------------------------------------------------------//
  898. //----------------------------------------------------------------------------------------------------------------//
  899. //Constructor
  900. //----------------------------------------------------------------------------------------------------------------//
  901. //----------------------------------------------------------------------------------------------------------------//
  902. func i32x Onglet_video_Constructor ()
  903. {
  904.     oOnglet_video.iWindowID = InitObject(
  905.         oOnglet_video.szName,
  906.         oOnglet_video.oFunc.pcreate,
  907.         oOnglet_video.oFunc.pevent
  908.     );
  909.     return oOnglet_video.iWindowID;
  910. }
  911.  
  912. //----------------------------------------------------------------------------------------------------------------//
  913. //----------------------------------------------------------------------------------------------------------------//
  914. //Destructor
  915. //----------------------------------------------------------------------------------------------------------------//
  916. //----------------------------------------------------------------------------------------------------------------//
  917. func void Onglet_video_Destructor ()
  918. {
  919.     DeleteComponent(oOnglet_video.iWindowID);
  920. }
  921.  
  922. //----------------------------------------------------------------------------------------------------------------//
  923. //----------------------------------------------------------------------------------------------------------------//
  924. //Onglet video Init member
  925. //----------------------------------------------------------------------------------------------------------------//
  926. //----------------------------------------------------------------------------------------------------------------//
  927. func void Onglet_video_InitMembers ()
  928. {
  929.     oOnglet_video.szName        = "Video Configuration";
  930.     oOnglet_video.oFunc.pcreate = Onglet_video_Create;
  931.     oOnglet_video.oFunc.pevent    = Onglet_video_Event;
  932. }
  933.