Have you ever seen this Done in MaxGUI

BlitzMax Forums/MaxGUI Module/Have you ever seen this Done in MaxGUI

Boulderdash(Posted 2007) [#1]
Click here to download!


SebHoll(Posted 2007) [#2]
Are you drawing gadgets directly to the Desktop? Although I like the idea, I'm not sure that it will work on Mac or Linux...


Dreamora(Posted 2007) [#3]
how about a screenshot?
Just a zip is kind of ... you know


Boulderdash(Posted 2007) [#4]
It is my first Attempt at HOOKs
The action (LOL) is controlled by the events
There is only one line of code in the Main Loop Wait Event()

Repeat
Wait Event()
Forever



Who was John Galt?(Posted 2007) [#5]
Oh Gav I'm liking it!


SebHoll(Posted 2007) [#6]

It is my first Attempt at HOOKs
The action (LOL) is controlled by the events
There is only one line of code in the Main Loop Wait Event()


When completely using hooks, use WaitSystem() instead of WaitEvent() in your main loop! You will no longer need the BRL.EventQueue module (although it's not going to make that much of a difference to your overall EXE size).

Just a little tip!


Boulderdash(Posted 2007) [#7]
Thanks SebHoll; Changes made

I have used the same technique to put a clock on the App Title bar.

Hooks are cool.


Ziltch(Posted 2007) [#8]
Very cool


Boulderdash(Posted 2007) [#9]
Im making an animated Application Icon now.... Will Post a Demo soon.
Have you ever seen an animated App Icon before? you will soon.... Im thinking of writing a collection of Demos and a Preprocessor with Modules for Injecting code to do this stuff, The preprocessor is mostly functional, But this is almost over my head until I experiment abit more.

I a New-e to MaxGUI really.


xlsior(Posted 2007) [#10]
Have you ever seen an animated App Icon before? you will soon....


Application icon in the title bar, or application icon on the desktop?

Back in the windows 3.x days there was a program that would animate your desktop icons. You wouldn't *believe* how slow that was on a 386SX with 2MB RAM. :-?


Boulderdash(Posted 2007) [#11]
Application Icon in the title bar


xlsior(Posted 2007) [#12]
By the way -- this pong thing really is pretty interesting, and I can think of a couple of other things where this could be really useful -- e.g. automatic updating system status stuff in the background, or a calendar, or...

Any change you may release the source code for this one?


Boulderdash(Posted 2007) [#13]
Im a Commodore64 programmer LOL, so you might laugh at me.


xlsior(Posted 2007) [#14]
Im a Commodore64 programmer LOL, so you might laugh at me.


Hey, horrible spaghetti code still beats "no code at all", by a long shot!


Boulderdash(Posted 2007) [#15]
You might want to use canvas's instead It will be more adaptable

Can anyone compile this for Mac or Lynx? Can you send me a copy? No changes please, just for my work (b)log


Framework BRL.Win32MaxGUI
Import BRL.FreeAudioAudio
Import BRL.Retro
Import BRL.Timer
Import BRL.EventQueue

Global Total_scans:Long,ts2:Int,ts3:Int
Global Paddle:TGadget[2]
Global Canvas:TGadget[2]
Global Ssound:Float
Global Sound_on:Int
Global Ball:TGadget
Global BExit:TGadget
Global y:Int[2]
Global Pdy:Float
Global bx:Float,by:Float
Global xpseed:Float=5.0
Global dx:Float=4.0,dy:Float=4.0

Global dw:Int = GadgetWidth( Desktop() )
Global dh:Int = GadgetHeight( Desktop() )

y[0]=50
y[1]=dh-200
bx=dw/2
by=dh/2

fr=10000
Global sample:TAudioSample=CreateAudioSample( 32,fr,SF_MONO8 )
For k=0 Until 32
f=0
If k>15 Then f=127
sample.samples[k]=f         ''Sin(k*360/32)*127.5+127.5
Next
Global sound:TSound=LoadSound( sample,True )
Global Sound_channel=CueSound(sound)
SetChannelVolume sound_channel,0.2

AppTitle$="Cannot Run Application"
Type TApplet 
Method OnEvent(Event:TEvent) Abstract
Method New()
AddHook EmitEventHook,eventhook,Self
End Method
Function eventhook:Object(id,data:Object,context:Object)
Local event:TEvent
Local app:TApplet
event=TEvent(data)
app=TApplet(context)
app.OnEvent event	
End Function
End Type

Type CheckApplet Extends TApplet
Field timer:TTimer
Method OnEvent(Event:TEvent)

Select event.id

Case EVENT_GADGETACTION
	Select Event.Source

			Case BExit
			End

		End Select
			
	Case EVENT_WINDOWCLOSE
	End

Case EVENT_TIMERTICK
bx:+dx
by:+dy

If sound_on=True
If MilliSecs()-100.0 > Ssound
PauseChannel Sound_channel
EndIf
EndIf

If bx<50
 dx=xpseed
 ResumeChannel sound_channel
 Ssound=MilliSecs()
 Sound_on=True
EndIf

If bx>dw-70
 dx=0.0-xpseed
 ResumeChannel sound_channel
 Ssound=MilliSecs()
 Sound_on=True
EndIf

If by<15
 dy=0.0-dy
 ResumeChannel sound_channel
 Ssound=MilliSecs()
 Sound_on=True
EndIf

If by>dh-72 
 dy=0.0-dy
 ResumeChannel sound_channel
 Ssound=MilliSecs()
 Sound_on=True
EndIf

For i=0 To 1
If by>y[i]
If dx>0.0
If i=0 Then Pdy=1.0 Else Pdy=5.0
If i=1 Then Pdy=5.0 Else Pdy=1.0
EndIf
If dx<0.0
If i=1 Then Pdy=1.0 Else Pdy=5.0
If i=0 Then Pdy=5.0 Else Pdy=1.0
EndIf
Else
If dx>0.0
If i=0 Then Pdy=-1.0 Else Pdy=-5.0
If i=1 Then Pdy=-5.0 Else Pdy=-1.0
EndIf
If dx<0.0
If i=1 Then Pdy=-1.0 Else Pdy=-5.0
If i=0 Then Pdy=-5.0 Else Pdy=-1.0
EndIf
EndIf
y[i]:+Pdy
Next

SetGadgetShape(Paddle[0],30,y[0]-50,20,100)
SetGadgetShape(Paddle[1],dw-50,y[1]-50,20,100)
SetGadgetShape(Ball,bx,by,20,20)

ts2:+1
ts2:&7
End Select
If ts2=1
ts2=2
ts3:+1
ts3:&15
If ts3<8
SetGadgetText(textareax,"Pong "+Left$("        ",ts3)+"+"+Right$("        ",7-ts3)+" Pong")
EndIf
If ts3>7
SetGadgetText(textareax,"Pong "+Left$("        ",7-(ts3-8))+"+"+Right$("        ",ts3-8)+" Pong")
EndIf
EndIf
End Method

Method Create:CheckApplet()
Local a:TApplet
timer=CreateTimer(100)
Return Self		
End Method
End Type

Local system_check_hook:CheckApplet
system_check_hook=New CheckApplet.Create()

Global Tool:TGadget=CreateWindow("", Dw-170,20,88,41,,WINDOW_TOOL)
Global linetop:TGadget=CreateWindow("", 10,12,dw-20,8,tool,WINDOW_TOOL)
Global linemiddle:TGadget=CreateWindow("", Dw/2,12,8,dh-55,tool,WINDOW_TOOL)
Global linebottom:TGadget=CreateWindow("",10,dh-50,dw-20,8,tool,WINDOW_TOOL)

BExit=CreateButton("Exit",0,21,88,20,tool,BUTTON_OK)
Global textareax=CreateTextArea(0-2,0-2,150,32,Tool)
SetGadgetLayout textareax,1,1,1,1
SetTextAreaText textareax,Null
SetGadgetColor(textareax,0,85,229)

paddle[0]=CreateWindow("", 30,y[0]-50, 20,100,,WINDOW_TOOL)
Global textareaa=CreateTextArea(0-2,0-2,30,120,paddle[0])
SetGadgetLayout textareaa,1,1,1,1
SetTextAreaText textareaa,Null
SetGadgetColor(textareaa,0,255,0)

paddle[1]=CreateWindow("", dw-50,y[1]-25, 20,100,,WINDOW_TOOL)
Global textareab=CreateTextArea(0-2,0-2,30,120,paddle[1])
SetGadgetLayout textareab,1,1,1,1
SetTextAreaText textareab,Null
SetGadgetColor(textareab,255,0,0)

ball=CreateWindow("", bx-10,by-10, 20,20,,WINDOW_TOOL)

ShowGadget(Tool)
Repeat
WaitSystem()
Forever





doswelk(Posted 2007) [#16]
After removing the win32 framework line it works on Ubuntu 7




Boulderdash(Posted 2007) [#17]
WOW - Hey is there a MAC emulator that can be used on WinXP to compile my MaxGUI stuff, Then I could make multiplatform APPs and see stuff like this for myself.

It appears the gadgets arent being displayed as a TOOL window.


Smokey(Posted 2007) [#18]
yes osx86 project

http://wiki.osx86project.org/wiki/index.php/Main_Page

it's not an emulator , I don't think so, but I tried it and work well on my pc, can compile program in Intel mac version.

It's run faster then my Mac PowerBook lol