could you test this

BlitzMax Forums/BlitzMax Programming/could you test this

hi !
you must have max gui. i post here because i don't know if it is a maxgui bug or another mistake inside my code.

    Global Pilote_graphique

    Global Win0:TGadget
    Global btnButton0:TGadget
    Global grpGroupBox0:TGadget
    Global lblLabel3:TGadget
    Global lblLabel4:TGadget
    Global lblLabel5:TGadget
    Global cobComboBox0:TGadget
    Global cobComboBox1:TGadget
    Global cobComboBox2:TGadget
    Global btnButton2:TGadget
    Global cavCanvas0:TGadget
    Global hImageCanvas:TImage
    
'    hImageCanvas:TImage = LoadImage ("incbin::media/titre_settings.png")
    
    Win0=CreateWindow("Zigwigwis blaster : settings",(GadgetWidth(Desktop())-358)/2,(GadgetHeight(Desktop())-300)/2,358,300,Desktop(),WINDOW_TITLEBAR|WINDOW_HIDDEN)
    
    btnButton0=CreateButton("Lauch game ",10,230,320,24,Win0,BUTTON_PUSH)
    
    grpGroupBox0=CreatePanel(10,104,320,120,Win0,PANEL_GROUP,"Settings :")
    lblLabel3=CreateLabel("Language :",84,3,50,16,grpGroupBox0,0)
    lblLabel4=CreateLabel("Graphics driver :",60,36,79,16,grpGroupBox0,0)
    lblLabel5=CreateLabel("Audio driver :",60,69,79,16,grpGroupBox0,0)
    
    cobComboBox0=CreateComboBox(146,0,140,20,grpGroupBox0)
    AddGadgetItem cobComboBox0,"English"
    AddGadgetItem cobComboBox0,"Français"
    SelectGadgetItem cobComboBox0,0
    
    cobComboBox1=CreateComboBox(146,33,140,20,grpGroupBox0)
    AddGadgetItem cobComboBox1,"DirectX"
    AddGadgetItem cobComboBox1,"OpenGL"
    SelectGadgetItem cobComboBox1,1
    
    cobComboBox2 = CreateComboBox(146 , 66 , 140 , 20 , grpGroupBox0)
    
    cavCanvas0=CreateCanvas(10,10,330,90,Win0)
    
    Global paintTimer:TTimer=CreateTimer(60)
    
    Const CTE_DRIVER_DIRECTX = 0
    Const CTE_DRIVER_OPENGL = 1
    
    Const CTE_LANGUE_FRANCAIS = 0
    Const CTE_LANGUE_ANGLAIS = 1
    
    Const CTE_PILOTE_AUDIO$ = "DirectSound"
    
' ==================================================================================================

        ShowGadget Win0
        
        For Local t$=EachIn AudioDrivers()
           AddGadgetItem cobComboBox2, t$
        Next
    
        SelectGadgetItem cobComboBox2,0
        
        Repeat
            Select WaitEvent()
                Case EVENT_GADGETACTION                        
                
                    Select EventSource()
                    
                        Case cobComboBox0
                        
                            Select GadgetItemText$ (cobComboBox0,SelectedGadgetItem(cobComboBox0))
                            
                                Case "English"
                                    SetGadgetText lblLabel3 , "Language :"
                                    SetGadgetText lblLabel4, "Graphics driver :"
                                    SetGadgetText lblLabel5, "Audio driver :"
                                    SetGadgetText btnButton0 , "Lauch game"
                                    SetGadgetText grpGroupBox0, "Settings :"
        
                                Case "Français"
                                    SetGadgetText lblLabel3 , "Langage :"
                                    SetGadgetText lblLabel4, "Pilote graphique :"
                                    SetGadgetText lblLabel5, "Pilote audio :"
                                    SetGadgetText btnButton0 , "Lancer le jeu"
                                    SetGadgetText grpGroupBox0, "Réglages :"
                            
                            End Select                
                        
                    
                        Case btnButton0    
                        
                            Select GadgetItemText$ (cobComboBox1,SelectedGadgetItem(cobComboBox1))
                            
                                Case "DirectX"
                                    Pilote_graphique = CTE_DRIVER_DIRECTX
                                Case "OpenGL"
                                    Pilote_graphique = CTE_DRIVER_OPENGL
                            
                            End Select
    
                            Pilote_audio$ = GadgetItemText$ (cobComboBox2,SelectedGadgetItem(cobComboBox2))
                            Exit
                
                        Case btnButton2    
                
                    End Select            
                    
                Case EVENT_TIMERTICK
                    SetGraphics CanvasGraphics(cavCanvas0)
                    Cls            
                    'DrawImage hImageCanvas , 0 , 0
                    SetColor 255,255,255
                    DrawText CTE_VERSION$, GadgetWidth(cavCanvas0)-TextWidth(CTE_VERSION$), GadgetHeight(cavCanvas0)-12
                    Flip
                    
                Case EVENT_WINDOWCLOSE                        
                    End
                    
            End Select
        Forever
        
        HideGadget Win0
        paintTimer = Null

' -------------------------------------------------------------------------------------------

    Select Pilote_graphique
    
        Case CTE_DRIVER_DIRECTX
            SetGraphicsDriver D3D7Max2DDriver()
            
        Case CTE_DRIVER_OPENGL
            SetGraphicsDriver GLMax2DDriver()
    End Select

' -------------------------------------------------------------------------------------------

    If Not GraphicsModeExists(1024,768,0, 0) Then
        Notify "marche pas"
        End
    End If

' -------------------------------------------------------------------------------------------

    Graphics 1024 , 768, 32

    While Not KeyDown (Key_escape)
    
        Cls
        DrawText "ok, press escape to exit ...",100,100
        Flip
    
    Wend


If i choose : english, directx and 'null' : nothing happen, the white text don't dispay on the black screen.

Works fine with opengl.

Please could you test this and report if you have the same problem here . I've tested this on two computer and have the same bug.

There is something with the windows/canvas and next directx usage, but i don't know where is my mistake.

Many thanks to you for your help !!!

Don't have Windows at the moment, but the OpenGL version works on a Mac. Only the dropdownlistboxes look a bit strange; it seems there are a few pixels missing.

I have the same problem and can't see what's wrong. Chossing DX *does* make it into the While/wend loop but it doesn't seem to create the graphics mode
 While Not KeyDown (Key_escape)
	Print GraphicsWidth() + " " + GraphicsHeight() + " " + GraphicsDepth() + " " + GraphicsHertz()
        Cls
        DrawText "ok, press escape to exit ...",100,100
        Flip
    
    Wend

shows 0 0 0 0

<EDIT> There was an example of this so try a few searches.

<edit2> here it is.

<edit3> and it seems to work OK
Replace Function test() with
	Function Test()
		Local e:TPreGame = TPreGame.Create()
		If e.UserChoice() Then Notify e.driver +", "+ e.screen +", "+ ..
		 e.width + "," + e.height + "," + e.depth + "," + e.hertz
		Select e.driver
			Case "DirectX"
				SetGraphicsDriver D3D7Max2DDriver()
			Case "OpenGL"
				GLMax2DDriver()
		End Select
		Graphics e.width , e.height , e.depth
		While Not KeyHit(KEY_ESCAPE)
			Cls
			DrawText "Hello World!" , 0 , 0
			Flip
		Wend
		TPreGame.Destroy e
	End Function


Same here. OPenGL also seemed to take a while to launch properly. Adding a Freegadget Win0 in your original code fixed it.

Many Thanks David it fix the issue here too. Now my program works fine !!! Have a nice day.