GLBasic forum

Main forum => Off Topic => Topic started by: trucidare on 2010-Nov-20

Title: Some Stuff - GLBasic related
Post by: trucidare on 2010-Nov-20
Here a snippet and a Setup for the first GUI application in glbasic.

Code (glbasic) Select
// --------------------------------- //
// Project: Music-Player
// Start: Thursday, November 18, 2010
// IDE Version: 8.148
// SETCURRENTDIR("Media") // seperate media and binaries?


AUTOPAUSE FALSE
SYSTEMPOINTER TRUE

GLOBAL GUI_WINDOW = 0
GLOBAL GUI_DIALOG = 1

GLOBAL GUI_BOX_VERTICAL = 1
GLOBAL GUI_BOX_HORIZONTAL = 0
GLOBAL GUI_BOX_BOXONLY = 1

HideMe()
GuiInit()
FMOD_Init()



hwndWindow = GuiCreateWindow("Music-Player",320,100,GUI_WINDOW,TRUE)
GuiSetWindowResizable(hwndWindow,FALSE)
GuiSetWindowMaximize(hwndWindow,FALSE)
GuiEventConnect(hwndWindow,"destroy")

tblLayout = GuiCreateTable(4,5,TRUE,TRUE)
GuiAddContainer(hwndWindow,tblLayout)

btnLast = GuiCreateButton("<--",TRUE)
  GuiTableAttach(tblLayout,btnLast,0,1,0,1)
  GuiEventConnect(btnLast,"clicked")

btnPlay = GuiCreateButton("Play",TRUE)
  GuiTableAttach(tblLayout,btnPlay,1,2,0,1)
  GuiEventConnect(btnPlay,"clicked")

btnOpen = GuiCreateButton("Open",TRUE)
  GuiTableAttach(tblLayout,btnOpen,2,3,0,1)
  GuiEventConnect(btnOpen,"clicked")

btnStop = GuiCreateButton("Stop",TRUE)
  GuiTableAttach(tblLayout,btnStop,3,4,0,1)
  GuiEventConnect(btnStop,"clicked")

btnNext = GuiCreateButton("-->",TRUE)
  GuiTableAttach(tblLayout,btnNext,4,5,0,1)
  GuiEventConnect(btnNext,"clicked")

progress = GuiCreateProgress("",TRUE)
   GuiTableAttach(tblLayout,progress,0,5,1,2)

btnVolM = GuiCreateButton("Vol -",TRUE)
  GuiTableAttach(tblLayout,btnVolM,0,1,2,4)
  GuiEventConnect(btnVolM,"clicked")

btnVolP = GuiCreateButton("+ Vol",TRUE)
      GuiTableAttach(tblLayout,btnVolP,4,5,2,4)
  GuiEventConnect(btnVolP,"clicked")

slider = GuiCreateSlider(0, 0, 100, 1, TRUE)
GuiTableAttach(tblLayout,slider,1,4,2,4)
GuiEventConnect(slider,"value-changed")
GuiSetSliderValue(slider,50)

GuiSetBlocking(FALSE)

GuiShowWidgetAll(tblLayout)


GuiMain()
GuiEnd()




CALLBACK FUNCTION EVENTS: WIDGET, EVENT
DEBUG WIDGET
DEBUG EVENT
SELECT WIDGET

CASE hwndWindow
END

CASE btnOpen
file$ = FILEREQUEST$(TRUE,"All Media|*.*")
FMOD_PlayStream(file$)

IF file$ <> "NO_FILE"
//ThThreadCreate("UpdateProgress")
GuiSetIdleTimeoutFor(progress)
GuiSetProgressText(progress,FMOD_GetTag$())
ENDIF

CASE btnPlay
IF FMOD_IsPlaying() <> 0
IF file$ <> "NO_FILE"
FMOD_PlayStream(file$)
ENDIF
ELSE
FMOD_Pause()
ENDIF

CASE btnStop
IF FMOD_IsPlaying <> 0 THEN FMOD_Stop()

CASE btnVolM
GuiSetSliderValue(slider,GuiGetSliderValue(slider)-5)

CASE btnVolP
GuiSetSliderValue(slider,GuiGetSliderValue(slider)+5)

CASE aboutDialog
GuiHideWidget(aboutDialog)

CASE slider
FMOD_SetVolume(GuiGetSliderValue(slider)/100)

ENDSELECT
ENDFUNCTION


FUNCTION ShowAbout:
aboutDialog = GuiCreateAboutDialog("Music-Player","1.0.0.0","Copyright by trucidare","comment","lgpl","http://www.glbasic.de","Nils Tonagel",TRUE)
  GuiEventConnect(aboutDialog,"destroy")
ENDFUNCTION

CALLBACK FUNCTION PROGRESSBARS: BARS
SELECT BARS
CASE progress
LOCAL pre%,val%
le# = FMOD_GetLength()
po# = FMOD_GetPosition()
percent# = po# / le#* 100
val% = percent#
IF val% <> pre%
pre% = val%
GuiSetProgressValue(BARS,percent#)
ENDIF
STDOUT "Bar: "+progress+": "+BARS
ENDSELECT
ENDFUNCTION


Download: http://www.zshare.net/download/82943455428dcd78/

EDIT/// Now with working progressbar, code updated

[attachment deleted by admin]
Title: Re: Some Stuff - GLBasic related
Post by: Ian Price on 2010-Nov-21
Nice one :)
Title: grrr
Post by: Marmor on 2010-Nov-21
läuft nicht .

zuerste fand der die msvcs80.dll nicht jetzt kann er zlib1.dll den deflatezheader nich aufrufen
:whip:      =D
Title: Re: Some Stuff - GLBasic related
Post by: trucidare on 2010-Nov-21
öhm blinzel blinzel - runtimes sind dabei und ms visual c# runtimes benutz ich auch nich.

Title: Re: Some Stuff - GLBasic related
Post by: MrTAToad on 2010-Nov-21
Is this Windows only ?
Title: Re: Some Stuff - GLBasic related
Post by: Marmor on 2010-Nov-21
(http://img41.imageshack.us/img41/152/unbenanntab.png)
Title: Re: Some Stuff - GLBasic related
Post by: trucidare on 2010-Nov-21
At this moment its windows only but have a look at this...

EDIT:// install a new zlib1.dll? i dont use it directly and on other pcs it runs fine, i think you have one installed which is not actual

[attachment deleted by admin]
Title: Re: Some Stuff - GLBasic related
Post by: Schranz0r on 2010-Nov-21
What GUI is that?

K, after i installed the player i see what Gui it is :D
Title: Re: Some Stuff - GLBasic related
Post by: trucidare on 2010-Nov-21
yep its THE GUI :D
Title: Re: Some Stuff - GLBasic related
Post by: Marmor on 2010-Nov-21
ok new zlib - now it works fine