Page 1 of 1

Gadget3D slow reaction

Posted: Sat Jan 03, 2015 6:00 pm
by StarBootics
Hello everyone,

This question may seem silly, is it normal to have to click several times on the same gadget before having a reaction?

I have try the Gadget3D example (examples/3d/Gadget3D.pb) and to change the state of OptionGadget3D()

The first option is on, I would like to have the 3rd on but I need to click several times on it in order to switch from the option #1 to option #3.
The same apply to the PanelGadget() switching from Tab #1 to Tab #2 or Tab #3.
To select an element inside a ComboBox() the same "clicking like crazy" apply.

PureBasic V 5.31 x64
Ubuntu Gnome 14.10 x64
NVIDIA binary driver - version 331.113

StarBootics

Re: Gadget3D slow reaction

Posted: Sat Jan 03, 2015 6:10 pm
by Kiffi
StarBootics wrote:This question may seem silly, is it normal to have to click several times on the same gadget before having a reaction?
here on Window 7: no problem.

Perhaps an Ubuntu-Problem?

Greetings ... Peter

Re: Gadget3D slow reaction

Posted: Sun Jan 04, 2015 8:38 am
by applePi
it works also in windows xp/ pb 5.31
but regarding pb linux my guess in the dark: it is possible the problem (in the linux version) with :
1- event managements between line 168-180
2- in Screen3DEvents()
try this using the scheme in FacialAnimation.pb example taken from PB linux distribution
if it does not work, try comment line: Event = WindowEvent3D(); or replace it with Event = WindowEvent (just an experiment)
i have added Case #PB_Event3D_CloseWindow ... from "Window3D.pb" example, and displaying the active 3d window number on the title bar since when we close this 3d window we can't write info on it anymore
there is an error in the official example, it contains #CloseButton while there is no #CloseButton
the modified example works on windows xp/ pb 5.31

Code: Select all

;
; ------------------------------------------------------------
;
;   	

Define.f KeyX, KeyY, MouseX, MouseY

Enumeration ; Window3D
  #MainWindow
  #SecondWindow
EndEnumeration


Enumeration ; Gadget3D
  #ActiveWindowLabel
  #CloseButton
  #ProgressBar
  #ComboBox
  #Panel
  #ListView
  #Image
  #Image2
  #ScrollArea
  #ScrollBar
  #String
  #Spin
  #Container
  #CheckBox
  #Editor
  #Option1
  #Option2
  #Option3
  #Button
EndEnumeration

If InitEngine3D()
  
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data", #PB_3DArchive_FileSystem)
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/GUI", #PB_3DArchive_FileSystem)
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Packs/desert.zip", #PB_3DArchive_Zip)
    
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  OpenWindow(0, 0, 0, 1000, 600, "Facial Animation", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
  OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0)
  
  SkyBox("desert07.jpg")
  CreateCamera(0, 0, 0, 100, 100)  ; Front camera
  MoveCamera(0, 0, 0, 100, #PB_Absolute)
  
  OpenWindow3D(#MainWindow, 50, 20, 280, 400, "Hello in 3D !", #PB_Window3D_SizeGadget)
  Top = 10
    TextGadget3D(#ActiveWindowLabel, 10, Top, 250, 25, "Active window: ") : Top + 30
    
    ;- ProgressBar
    TextGadget3D(#PB_Any, 10, Top, 100, 25, "Progress bar: ")
    ProgressBarGadget3D(#ProgressBar, 110, Top, 150, 25, 0, 100) : Top + 30
    SetGadgetState3D(#ProgressBar, 30)
    GadgetToolTip3D(#ProgressBar, "I'm a progress bar")
    
    ;- ComboBox
    TextGadget3D(#PB_Any, 10, Top, 100, 25, "Combo box: ")
    ComboBoxGadget3D(#ComboBox, 110, Top, 150, 25) : Top + 30
    GadgetToolTip3D(#ComboBox, "Combobox tooltip !")
    AddGadgetItem3D(#ComboBox, -1, "Item 1")
    AddGadgetItem3D(#ComboBox, -1, "Item 2")
    AddGadgetItem3D(#ComboBox, -1, "Item 3")
    AddGadgetItem3D(#ComboBox, -1, "Item 4")
    
     ;- ScrollBar
    TextGadget3D(#PB_Any, 10, Top, 100, 25, "Scroll bar: ")
    ScrollBarGadget3D(#ScrollBar, 110, Top+7, 150, 10, 0, 100, 20) : Top + 30
    SetGadgetState3D(#ScrollBar, 30)
        
    ;- String
    TextGadget3D(#PB_Any, 10, Top, 100, 25, "String: ")
    StringGadget3D(#String, 110, Top, 150, 25, "Modify me") : Top + 30
    GadgetToolTip3D(#String, "I'm a string gadget")
    
    ;- CheckBox
    TextGadget3D(#PB_Any, 10, Top, 100, 25, "Check box: ")
    CheckBoxGadget3D(#CheckBox, 110, Top, 150, 25, "Enable something") : Top + 30
    GadgetToolTip3D(#CheckBox, "I'm a checkbox !")
    SetGadgetState3D(#CheckBox, 1)
    
    ;- Spinner
    TextGadget3D(#PB_Any, 10, Top, 100, 25, "Spinner: ")
    SpinGadget3D(#Spin, 110, Top, 150, 25, 0, 100) : Top + 30
    GadgetToolTip3D(#Spin, "I'm a spinner !")
    
    ;- Options
    TextGadget3D(#PB_Any, 10, Top, 100, 25, "Options: ")
    OptionGadget3D(#Option1, 110, Top, 150, 25, "Choice 1") : Top + 30
    OptionGadget3D(#Option2, 110, Top, 150, 25, "Choice 2") : Top + 30
    OptionGadget3D(#Option3, 110, Top, 150, 25, "Choice 3") : Top + 30
    GadgetToolTip3D(#Option1, "I'm option 1 !")
    SetGadgetState3D(#Option2, 1)
    
    ;- Button
    TextGadget3D(#PB_Any, 10, Top, 100, 25, "Button: ")
    ButtonGadget3D(#Button, 110, Top, 150, 25, "Click me !") : Top + 30
    GadgetToolTip3D(#Button, "I'm a button !")
        
    
    OpenWindow3D(#SecondWindow, 400, 150, 400, 400, "More gadgets", #PB_Window3D_SizeGadget)
    
    PanelGadget3D(#Panel, 10, 10, 370, 350)
      GadgetToolTip3D(#Panel, "Panel tooltip !")
      AddGadgetItem3D(#Panel, -1, "First")
        ListViewGadget3D(#ListView, 10, 10, 200, 200, #PB_ListView3D_Multiselect) 
          For k = 0 To 20
            AddGadgetItem3D(#ListView, -1, "Item "+Str(k))
          Next
          
      AddGadgetItem3D(#Panel, -1, "Second")
        ContainerGadget3D(#Container, 0, 0, 400, 400)
          GadgetToolTip3D(#Container, "Container tooltip !")
      
          LoadTexture(0, "clouds.jpg")
          ImageGadget3D(#Image, 10, 10, 128, 128, TextureID(0))
      
          ScrollAreaGadget3D(#ScrollArea, 10, 150, 100, 100, 256, 256, 30)
          GadgetToolTip3D(#ScrollArea, "Scroll area tooltip !")
            ImageGadget3D(#Image2, 10, 10, 256, 256, TextureID(0))
          CloseGadgetList3D()
        
        CloseGadgetList3D()
    
      AddGadgetItem3D(#Panel, -1, "Third")
        EditorGadget3D(#Editor, 10, 10, 300, 200)
        SetGadgetText3D(#Editor, "Multi" + #LF$ + "Line" + #LF$ + "Editor !")
      
    CloseGadgetList3D()
  Repeat
      If ExamineKeyboard() And ExamineMouse()
        Input$ = KeyboardInkey()
        
        SpecialKey = 0
        If     KeyboardPushed(#PB_Key_Back)   :  SpecialKey = #PB_Key_Back
        ElseIf KeyboardPushed(#PB_Key_Return) : SpecialKey = #PB_Key_Return
        ElseIf KeyboardPushed(#PB_Key_Left)   : SpecialKey = #PB_Key_Left
        ElseIf KeyboardPushed(#PB_Key_Right)  : SpecialKey = #PB_Key_Right
        ElseIf KeyboardPushed(#PB_Key_Up)     : SpecialKey = #PB_Key_Up
        ElseIf KeyboardPushed(#PB_Key_Down)   : SpecialKey = #PB_Key_Down
        ElseIf KeyboardPushed(#PB_Key_Delete) : SpecialKey = #PB_Key_Delete
        EndIf
        
        InputEvent3D(MouseX(), MouseY(), MouseButton(#PB_MouseButton_Left), Input$, SpecialKey)
      EndIf
      
      ; Handle the GUI 3D events, it's similar to regular GUI events
      ;
      Repeat
      	Event = WindowEvent3D()
      	
      	;SetGadgetText3D(#ActiveWindowLabel, "Active #Window3D: "+Str(GetActiveWindow3D()))
      	SetWindowTitle(0, "Active #Window3D: "+Str(GetActiveWindow3D()))

      	Select Event
      	  Case #PB_Event3D_CloseWindow
      	    
      		  If EventWindow3D() = #MainWindow
      		    CloseWindow3D(#MainWindow)
      		    
      		  EndIf
      		  
      		Case #PB_Event3D_Gadget
      		  If EventGadget3D() = #Button
      		    CloseWindow3D(#MainWindow)
      		  EndIf
      			
      	EndSelect
      Until Event = 0
      
      RenderWorld()
      
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
      
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
  

Re: Gadget3D slow reaction

Posted: Sun Jan 04, 2015 4:31 pm
by StarBootics
Hello everyone,

Just a little correction, the problem of slow reaction is in WindowedScreen only. In FullScreen the gadget are reactive but in fullscreen the size of the window are ok in relation to the size of the screen but not the text of the gadgets

Regards
StarBootics