Maurer rose

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
Realizimo
User
User
Posts: 64
Joined: Sun Nov 25, 2012 5:27 pm
Location: Sweden

Maurer rose

Post by Realizimo »

Code: Select all

;- ==== Maurer rose ====
EnableExplicit
InitSprite()
InitKeyboard()
;- -------- window
Global.i xx,xx2,yy,yy2,yy3
Global.s win$=Space(20)+"Pure Basic"+Space(70)+"Maurer rose"
Define.i desk=ExamineDesktops()-1
; desk=0
Global.i desk_xx=DesktopX(desk)
Global.i desk_yy=DesktopY(desk)
Global.i desk_x=DesktopWidth(desk)
Global.i desk_y=DesktopHeight(desk)

Procedure scrw()
  yy = 800 : yy2=yy/2 : yy3=yy2-15
  xx = 800 : xx2=xx/2  
  OpenWindow(0 , 0 , 0 , xx + 200 , yy ,win$ ,   13107201 )
  ResizeWindow(0 , #PB_Ignore , 24 , #PB_Ignore , #PB_Ignore)
  OpenWindowedScreen(WindowID(0) , 0 , 0 , xx , yy)
EndProcedure

Procedure scrf()  
  yy = desk_y : yy2 = yy/2 : yy3 = yy2-15
  xx = desk_x : xx2 = yy2
  xx = xx/2-yy/2  
  OpenWindow(0 , desk_xx , desk_yy , desk_x , desk_y , "" ,   #PB_Window_BorderLess )
  SetWindowColor(0,0)
  OpenWindowedScreen(WindowID(0) , xx/2 , 0 , yy , yy)
  xx = xx+yy
EndProcedure
scrw()

Global.f n , d
Global.i nf , df
Global.i ii , speed.i , speed2.i , onoff.i , a.i
n= 5 : nf= 0 : d= 29 : df= 0 : ii= 360 : speed= 0 : speed2= 0 : onoff= %111

#speedmax=2000
LoadFont(0 , "Tahoma" , 14)
SetGadgetFont(#PB_Default , FontID(0))

#xxx=45
Enumeration 4
  #screen: #red1: #red2: #red3: #blue1: #blue2: #blue3
  #q1: #q2: #speed_a1: #speed_a2: #speed_b1: #speed_b2
EndEnumeration
Procedure onoff()
  onoff=0
  For a= 0 To 2: onoff|GetGadgetState(a)<<a: Next a
EndProcedure

Procedure get_n()
  nf=GetGadgetState(#red2)
  n=GetGadgetState(#red1)+nf/10000
  SetGadgetText(#red3,StrF(n,4))
EndProcedure
Procedure get_d()
  df=GetGadgetState(#blue2)
  d=GetGadgetState(#blue1)+df/10000
  SetGadgetText(#blue3,StrF(d,4))
EndProcedure
Procedure get_ii()
  ii=GetGadgetState(#q1)
  SetGadgetText(#q2,Str(ii))
EndProcedure

Procedure get_speed()
  speed=GetGadgetState(#speed_a1)
  SetGadgetText(#speed_a2,Str(speed))
EndProcedure
Procedure get_speed2()
  speed2=GetGadgetState(#speed_b1)
  SetGadgetText(#speed_b2,Str(speed2))
EndProcedure

Procedure gadgets()
  ButtonGadget(#screen,xx+20 ,20 ,90 ,28  ,"screen")
  CheckBoxGadget(0,xx+20 ,70 ,90 ,28  ,"red top")
  CheckBoxGadget(1,xx+20 ,100 ,90 ,28  ,"red on")
  CheckBoxGadget(2,xx+20 ,130 ,90 ,28  ,"blue on")
  For a= 0 To 2:  SetGadgetState(a,1&(onoff>>a)):BindGadgetEvent (a , @onoff()): Next a
  TextGadget   (80 ,xx+4,175 ,190 ,23  , "Red        Blue", #PB_Text_Center)
  
  TrackBarGadget (#red1 ,xx+20       ,200 ,25   ,200 ,1, 1000, #PB_TrackBar_Vertical)
  TrackBarGadget (#red2 ,xx+20+#xxx*1,200 ,25   ,200 ,0, 10000, #PB_TrackBar_Vertical)
  TextGadget     (#red3 ,xx +6       ,404 ,90 ,23  , "", #PB_Text_Center)
  SetGadgetState (#red1 ,Int(n)):   SetGadgetState (#red2, nf):get_n()
  BindGadgetEvent(#red1 ,@get_n()): BindGadgetEvent(#red2, @get_n())
  
  TrackBarGadget (#blue1 ,xx+20+#xxx*2 ,200 ,25   ,200 ,1, 1000, #PB_TrackBar_Vertical)
  TrackBarGadget (#blue2 ,xx+20+#xxx*3 ,200 ,25   ,200 ,0, 10000, #PB_TrackBar_Vertical)
  TextGadget     (#blue3 ,xx+6+ #xxx*2 ,404 ,90 ,23  , "", #PB_Text_Center)
  SetGadgetState (#blue1 ,Int(d)):   SetGadgetState (#blue2, df):get_d()
  BindGadgetEvent(#blue1 ,@get_d()): BindGadgetEvent(#blue2, @get_d())
  ; ================
  
  TextGadget   (81 ,xx+6,430 ,190 ,23  , "   Q            Speed")
  
  TrackBarGadget (#q1 ,xx+20+#xxx*0 ,460 ,25 ,200 ,10, 1000, #PB_TrackBar_Vertical)
  TextGadget     (#q2 ,xx+1+#xxx*0 ,664 ,#xxx+10 ,23  , "", #PB_Text_Center)
  SetGadgetState (#q1,ii):get_ii()
  BindGadgetEvent(#q1 ,@get_ii())
  
  TrackBarGadget (#speed_a1  ,xx+20+#xxx*1.5 ,460 ,25   ,200 , 0,#speedmax, #PB_TrackBar_Vertical)
  TextGadget     (#speed_a2 ,xx+2+#xxx*1.5 ,664 ,#xxx+10 ,23  , "", #PB_Text_Center)
  SetGadgetState (#speed_a1,speed):get_speed()
  BindGadgetEvent(#speed_a1 , @get_speed())
  
  TrackBarGadget (#speed_b1  ,xx+20+#xxx*3 ,460 ,25   ,200 , 0,#speedmax, #PB_TrackBar_Vertical)
  TextGadget     (#speed_b2 ,xx+2+#xxx*3 ,664 ,#xxx+10 ,23  , "", #PB_Text_Center)
  SetGadgetState (#speed_b1,speed2):get_speed2()
  BindGadgetEvent(#speed_b1 , @get_speed2())
  
  Repeat : Until WaitWindowEvent()=275
EndProcedure

gadgets()

Global.i i ,x,y,x2,y2,scr
Global.d k,kk,r, theta,ff

Procedure roseblue()
  For  i = 0 To ii
    theta = i*(360/ii)+ff / d
    k = theta * d * #PI / 180;
    r = yy3 * Sin(n*k)     ;
    x = r * Cos(k+kk) 
    y = r * Sin(k+kk)   
    If i>0 :LineXY(x,y,x2,y2,#Blue): EndIf
    x2=x :y2=y
  Next i
EndProcedure

Procedure rosered()
  For  i = 0 To ii
    theta = i*(360/ii)+ff
    k = theta * #PI / 180
    r = yy3 * Sin(n*k)     ;
    x = r * Cos(k+kk) 
    y = r * Sin(k+kk)   
    If i>0 :LineXY(x,y,x2,y2,#Red): EndIf
    Circle(x,y,2,#Red)
    x2=x :y2=y
  Next i
EndProcedure
Procedure SetClipb()
  Protected.s clip$
  clip$= "n= "+Str(Int(n))+" : "
  clip$+ "nf= "+Str(nf)+" : "
  clip$+ "d= "+Str(Int(d))+" : "
  clip$+ "df= "+Str(df)+" : "
  clip$+ "ii= "+Str(ii)+" : "
  clip$+ "speed= "+Str(speed)+" : "
  clip$+ "speed2= "+Str(speed2)+" : "
  clip$+ "onoff= %"+Bin(onoff)
  SetClipboardText(clip$)
EndProcedure

Define.i flagg
Repeat
  ff+speed/1000
  kk+speed2/1000
  ClearScreen(0)
  
  StartDrawing(ScreenOutput())
  SetOrigin(xx2, yy2) 
  If onoff&5=5 : roseblue(): EndIf
  If onoff&2   : rosered() : EndIf
  If onoff&5=4 : roseblue(): EndIf
  StopDrawing()  
  
  FlipBuffers()
  ExamineKeyboard()
  If KeyboardReleased(#PB_Key_F) Or EventGadget()=#screen  :scr!1
    If scr=1 : scrf() : Else : scrw(): EndIf
    gadgets()
  EndIf
  If KeyboardPushed(#PB_Key_All)=0 : flagg=0 : EndIf
  If KeyboardPushed(#PB_Key_All) And flagg=0
    If KeyboardPushed(#PB_Key_C) : SetClipb(): flagg=2
    ElseIf KeyboardPushed(#PB_Key_0): flagg=1
      n= 5 : nf= 0 : d= 29 : df= 0 : ii= 360 : speed= 0 : speed2= 0 : onoff= %111
    ElseIf KeyboardPushed(#PB_Key_1): flagg=1
      n= 121 : nf= 96 : d= 38 : df= 9969 : ii= 130 : speed= 1 : speed2= 1 : onoff= %110
    ElseIf KeyboardPushed(#PB_Key_2): flagg=1
       n= 121 : nf= 2676 : d= 687 : df= 0 : ii= 916 : speed= 21 : speed2= 0 : onoff= %100
    ElseIf KeyboardPushed(#PB_Key_3): flagg=1
     
    ElseIf KeyboardPushed(#PB_Key_4): flagg=1
    ElseIf KeyboardPushed(#PB_Key_5): flagg=1
    ElseIf KeyboardPushed(#PB_Key_6): flagg=1
    ElseIf KeyboardPushed(#PB_Key_7): flagg=1
    ElseIf KeyboardPushed(#PB_Key_8): flagg=1
    ElseIf KeyboardPushed(#PB_Key_9): flagg=1
    ElseIf KeyboardPushed(#PB_Key_Escape): End
    EndIf
    If flagg=1 
      SetGadgetState(#red1,n)
      SetGadgetState(#red2,nf)
      n+nf/10000
      SetGadgetText(#red3,StrF(n,4))
      SetGadgetState(#blue1,d)
      SetGadgetState(#blue2,df)
      d+df/10000
      SetGadgetText(#blue3,StrF(d,4))      
    EndIf
  EndIf  
Until WindowEvent()=#PB_Event_CloseWindow
hey! some improvements
key "c" = clip = variables
then copy clip in row 183 and forwards you have "hotkeys" 0 to 9
a save/load maybe vill work better but i stop here
Last edited by Realizimo on Sat Jan 09, 2021 5:50 pm, edited 2 times in total.
User avatar
Bisonte
Addict
Addict
Posts: 1226
Joined: Tue Oct 09, 2007 2:15 am

Re: Maurer rose

Post by Bisonte »

Nice Image
PureBasic 6.04 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: Maurer rose

Post by Mijikai »

I like it :)
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Maurer rose

Post by Saki »

Nice, but write #desk=0 or it crash
地球上の平和
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1243
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: Maurer rose

Post by Paul »

Saki wrote:Nice, but write #desk=0 or it crash
Not if you have more than 1 monitor :D
Image Image
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Maurer rose

Post by Saki »

I am poor, i have , same the mostly here only one .... :cry:
地球上の平和
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Maurer rose

Post by BarryG »

Beautiful! Just goes to show there's so many hidden patterns in life that we never notice, ie. remove the blue star and you'd never know there's a star there at all.

Wikipedia (with some other source codes) -> https://en.wikipedia.org/wiki/Maurer_rose
Realizimo
User
User
Posts: 64
Joined: Sun Nov 25, 2012 5:27 pm
Location: Sweden

Re: Maurer rose

Post by Realizimo »

Saki wrote:Nice, but write #desk=0 or it crash
Yes I forgot , sorry but now everyons know,thank you
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Maurer rose

Post by Kwai chang caine »

Splendid :shock:
Very impressive the numerous line writing in few secondes
I like it too, thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
User avatar
SPH
Enthusiast
Enthusiast
Posts: 268
Joined: Tue Jan 04, 2011 6:21 pm

Re: Maurer rose

Post by SPH »

Kwai chang caine wrote:Splendid :shock:
Very impressive the numerous line writing in few secondes
I like it too, thanks for sharing 8)
+1
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Maurer rose

Post by Saki »

Hi,
yes, with the desktop handling is not always so easy.
You must also consider that the desktops can be different sizes.
Just to show you other pitfalls:
Set your desktop scaling to 125% or 150%.
Your output on full screen then slips more and more to the right and bottom out of the desktop.
This is a mistake that is often made when people output games to the screen.
In connection with a read out mouse position nothing works anymore.
Then switch on additional DPI aware and try to adjust the correct output to the windowed screen.
The output is also probably even faster if you do it on a sprite rather than directly on the screen.
Then you can also automatically use the color black as mask color for the sprite,
output and scale it flexibly on any background.
But there is much more, circular gradient colors for example.

Best Regards Saki
地球上の平和
Realizimo
User
User
Posts: 64
Joined: Sun Nov 25, 2012 5:27 pm
Location: Sweden

Re: Maurer rose

Post by Realizimo »

Saki wrote:Hi,
yes, with the desktop handling is not always so easy.
You must also consider that the desktops can be different sizes.
Just to show you other pitfalls:
Set your desktop scaling to 125% or 150%.
Your output on full screen then slips more and more to the right and bottom out of the desktop.
This is a mistake that is often made when people output games to the screen.
In connection with a read out mouse position nothing works anymore.
Then switch on additional DPI aware and try to adjust the correct output to the windowed screen.
The output is also probably even faster if you do it on a sprite rather than directly on the screen.
Then you can also automatically use the color black as mask color for the sprite,
output and scale it flexibly on any background.
But there is much more, circular gradient colors for example.

Best Regards Saki
Realizimo
User
User
Posts: 64
Joined: Sun Nov 25, 2012 5:27 pm
Location: Sweden

Re: Maurer rose

Post by Realizimo »

Realizimo wrote:
Saki wrote:Hi,
yes, with the desktop handling is not always so easy.
You must also consider that the desktops can be different sizes.
Just to show you other pitfalls:
Set your desktop scaling to 125% or 150%.
Your output on full screen then slips more and more to the right and bottom out of the desktop.
This is a mistake that is often made when people output games to the screen.
In connection with a read out mouse position nothing works anymore.
Then switch on additional DPI aware and try to adjust the correct output to the windowed screen.
The output is also probably even faster if you do it on a sprite rather than directly on the screen.
Then you can also automatically use the color black as mask color for the sprite,
output and scale it flexibly on any background.
But there is much more, circular gradient colors for example.

Best Regards Saki
Yes it is faster with a sprite
thank you

Code: Select all

;- ==== Maurer rose ====
EnableExplicit
InitSprite()
InitKeyboard()
;- -------- window
Global.i xx,xx2,yy,yy2,yy3
Global.s win$=Space(20)+"Pure Basic"+Space(70)+"Maurer rose"
Define.i desk=ExamineDesktops()-1
; desk=0
Global.i desk_xx=DesktopX(desk)
Global.i desk_yy=DesktopY(desk)
Global.i desk_x=DesktopWidth(desk)
Global.i desk_y=DesktopHeight(desk)

Procedure scrw()
  yy = 800 : yy2=yy/2 : yy3=yy2-15
  xx = 800 : xx2=xx/2
  OpenWindow(0 , 0 , 0 , xx + 200 , yy ,win$ ,   13107201 )
  ResizeWindow(0 , #PB_Ignore , 24 , #PB_Ignore , #PB_Ignore)
  OpenWindowedScreen(WindowID(0) , 0 , 0 , xx , yy)
  CreateSprite(0, yy, yy)
EndProcedure

Procedure scrf()  
  yy = desk_y : yy2 = yy/2 : yy3 = yy2-15
  xx = desk_x : xx2 = yy2
  xx = xx/2-yy/2  
  OpenWindow(0 , desk_xx , desk_yy , desk_x , desk_y , "" ,   #PB_Window_BorderLess )
  SetWindowColor(0,0)
  OpenWindowedScreen(WindowID(0) , xx/2 , 0 , yy , yy)
  xx = xx+yy
  CreateSprite(0, yy, yy)
EndProcedure
scrw()

Global.f n , d
Global.i nf , df
Global.i ii , speed.i , speed2.i , onoff.i , a.i
n= 5 : nf= 0 : d= 29 : df= 0 : ii= 360 : speed= 0 : speed2= 0 : onoff= %111

#speedmax=2000
LoadFont(0 , "Tahoma" , 14)
SetGadgetFont(#PB_Default , FontID(0))

#xxx=45
Enumeration 4
  #screen: #red1: #red2: #red3: #blue1: #blue2: #blue3
  #q1: #q2: #speed_a1: #speed_a2: #speed_b1: #speed_b2
EndEnumeration
Procedure onoff()
  onoff=0
  For a= 0 To 2: onoff|GetGadgetState(a)<<a: Next a
EndProcedure
Procedure get_n()
  nf=GetGadgetState(#red2)
  n=GetGadgetState(#red1)+nf/10000
  SetGadgetText(#red3,StrF(n,4))
EndProcedure
Procedure get_d()
  df=GetGadgetState(#blue2)
  d=GetGadgetState(#blue1)+df/10000
  SetGadgetText(#blue3,StrF(d,4))
EndProcedure
Procedure get_ii()
  ii=GetGadgetState(#q1)
  SetGadgetText(#q2,Str(ii))
EndProcedure
Procedure get_speed()
  speed=GetGadgetState(#speed_a1)
  SetGadgetText(#speed_a2,Str(speed))
EndProcedure
Procedure get_speed2()
  speed2=GetGadgetState(#speed_b1)
  SetGadgetText(#speed_b2,Str(speed2))
EndProcedure

Procedure gadgets()
  ButtonGadget(#screen,xx+20 ,20 ,90 ,28  ,"screen")
  CheckBoxGadget(0,xx+20 ,70 ,90 ,28  ,"red top")
  CheckBoxGadget(1,xx+20 ,100 ,90 ,28  ,"red on")
  CheckBoxGadget(2,xx+20 ,130 ,90 ,28  ,"blue on")
  For a= 0 To 2:  SetGadgetState(a,1&(onoff>>a)):BindGadgetEvent (a , @onoff()): Next a
  TextGadget   (80 ,xx+4,175 ,190 ,23  , "Red        Blue", #PB_Text_Center)
  TrackBarGadget (#red1 ,xx+20       ,200 ,25   ,200 ,1, 1000, #PB_TrackBar_Vertical)
  TrackBarGadget (#red2 ,xx+20+#xxx*1,200 ,25   ,200 ,0, 10000, #PB_TrackBar_Vertical)
  TextGadget     (#red3 ,xx +6       ,404 ,90 ,23  , "", #PB_Text_Center)
  SetGadgetState (#red1 ,Int(n)):   SetGadgetState (#red2, nf):get_n()
  BindGadgetEvent(#red1 ,@get_n()): BindGadgetEvent(#red2, @get_n())
  
  TrackBarGadget (#blue1 ,xx+20+#xxx*2 ,200 ,25   ,200 ,1, 1000, #PB_TrackBar_Vertical)
  TrackBarGadget (#blue2 ,xx+20+#xxx*3 ,200 ,25   ,200 ,0, 10000, #PB_TrackBar_Vertical)
  TextGadget     (#blue3 ,xx+6+ #xxx*2 ,404 ,90 ,23  , "", #PB_Text_Center)
  SetGadgetState (#blue1 ,Int(d)):   SetGadgetState (#blue2, df):get_d()
  BindGadgetEvent(#blue1 ,@get_d()): BindGadgetEvent(#blue2, @get_d())
  ; ================
  
  TextGadget   (81 ,xx+6,430 ,190 ,23  , "   Q            Speed")
  
  TrackBarGadget (#q1 ,xx+20+#xxx*0 ,460 ,25 ,200 ,10, 10000, #PB_TrackBar_Vertical)
  TextGadget     (#q2 ,xx+1+#xxx*0 ,664 ,#xxx+10 ,23  , "", #PB_Text_Center)
  SetGadgetState (#q1,ii):get_ii()
  BindGadgetEvent(#q1 ,@get_ii())
  
  TrackBarGadget (#speed_a1  ,xx+20+#xxx*1.5 ,460 ,25   ,200 , 0,#speedmax, #PB_TrackBar_Vertical)
  TextGadget     (#speed_a2 ,xx+2+#xxx*1.5 ,664 ,#xxx+10 ,23  , "", #PB_Text_Center)
  SetGadgetState (#speed_a1,speed):get_speed()
  BindGadgetEvent(#speed_a1 , @get_speed())
  
  TrackBarGadget (#speed_b1  ,xx+20+#xxx*3 ,460 ,25   ,200 , 0,#speedmax, #PB_TrackBar_Vertical)
  TextGadget     (#speed_b2 ,xx+2+#xxx*3 ,664 ,#xxx+10 ,23  , "", #PB_Text_Center)
  SetGadgetState (#speed_b1,speed2):get_speed2()
  BindGadgetEvent(#speed_b1 , @get_speed2())
  
  Repeat : Until WaitWindowEvent()=275
EndProcedure

gadgets()

Global.i i ,x,y,x2,y2,scr
Global.d k,kk,r, theta,ff

Procedure roseblue()
  For  i = 0 To ii
    theta = i*(360/ii)+ff / d
    k = theta * d * #PI / 180;
    r = yy3 * Sin(n*k)       ;
    x = r * Cos(k+kk) 
    y = r * Sin(k+kk)   
    If i>0 :LineXY(x,y,x2,y2,#Blue): EndIf
    x2=x :y2=y
  Next i
EndProcedure

Procedure rosered()
  For  i = 0 To ii
    theta = i*(360/ii)+ff
    k = theta * #PI / 180
    r = yy3 * Sin(n*k)     ;
    x = r * Cos(k+kk) 
    y = r * Sin(k+kk)   
    If i>0 :LineXY(x,y,x2,y2,#Red): EndIf
    Circle(x,y,2,#Red)
    x2=x :y2=y
  Next i
EndProcedure
Procedure SetClipb()
  Protected.s clip$
  clip$= "n= "+Str(Int(n))+" : "
  clip$+ "nf= "+Str(nf)+" : "
  clip$+ "d= "+Str(Int(d))+" : "
  clip$+ "df= "+Str(df)+" : "
  clip$+ "ii= "+Str(ii)+" : "
  clip$+ "speed= "+Str(speed)+" : "
  clip$+ "speed2= "+Str(speed2)+" : "
  clip$+ "onoff= %"+Bin(onoff)
  SetClipboardText(clip$)
EndProcedure

Define.i flag
Repeat
  ff+speed/1000
  kk+speed2/1000
  StartDrawing(SpriteOutput(0))
  Box(0,0,xx, yy,#Black)
  SetOrigin(xx2, yy2) 
  If onoff&5=5 : roseblue(): EndIf
  If onoff&2   : rosered() : EndIf
  If onoff&5=4 : roseblue(): EndIf
  StopDrawing()

  FlipBuffers()  
  DisplaySprite(0, 0,0)  
  
  ExamineKeyboard()
  If KeyboardReleased(#PB_Key_F) Or EventGadget()=#screen  :scr!1
    If scr=1 : scrf() : Else : scrw(): EndIf
    gadgets()
  EndIf
  If KeyboardPushed(#PB_Key_All)=0 : flag=0 : EndIf
  If KeyboardPushed(#PB_Key_All) And flag=0
    If KeyboardPushed(#PB_Key_C) : SetClipb(): flag=2
    ElseIf KeyboardPushed(#PB_Key_0): flag=1
      n= 5 : nf= 0 : d= 29 : df= 0 : ii= 360 : speed= 0 : speed2= 0 : onoff= %111
    ElseIf KeyboardPushed(#PB_Key_1): flag=1
      n= 121 : nf= 96 : d= 38 : df= 9969 : ii= 130 : speed= 1 : speed2= 1 : onoff= %110
    ElseIf KeyboardPushed(#PB_Key_2): flag=1
      n= 121 : nf= 2676 : d= 687 : df= 0 : ii= 916 : speed= 21 : speed2= 0 : onoff= %100
    ElseIf KeyboardPushed(#PB_Key_3): flag=1
      n= 13 : nf= 0 : d= 152 : df= 0 : ii= 805 : speed= 69 : speed2= 1 : onoff= %110
    ElseIf KeyboardPushed(#PB_Key_4): flag=1
      n= 13 : nf= 0 : d= 164 : df= 9143 : ii= 805 : speed= 69 : speed2= 1 : onoff= %110
    ElseIf KeyboardPushed(#PB_Key_5): flag=0      
    ElseIf KeyboardPushed(#PB_Key_6): flag=0
    ElseIf KeyboardPushed(#PB_Key_7): flag=0
    ElseIf KeyboardPushed(#PB_Key_8): flag=0
    ElseIf KeyboardPushed(#PB_Key_9): flag=0
    ElseIf KeyboardPushed(#PB_Key_Escape): End
    EndIf
    If flag=1 
      SetGadgetState(#red1,n)
      SetGadgetState(#red2,nf)
      n+nf/10000
      SetGadgetText(#red3,StrF(n,4))
      SetGadgetState(#blue1,d)
      SetGadgetState(#blue2,df)
      d+df/10000
      SetGadgetText(#blue3,StrF(d,4)) 
      SetGadgetState (#q1,ii)
      SetGadgetText(#q2,Str(ii))
      SetGadgetState (#speed_a1,speed)
      SetGadgetText(#speed_a2,Str(speed))
      SetGadgetState (#speed_b1,speed2)
      SetGadgetText(#speed_b2,Str(speed2))
      For a= 0 To 2:  SetGadgetState(a,1&(onoff>>a)) : Next a
    EndIf
  EndIf  
Until WindowEvent()=#PB_Event_CloseWindow
User avatar
Otrebor
Enthusiast
Enthusiast
Posts: 199
Joined: Mon Mar 17, 2014 1:42 pm
Location: São Paulo, Brasil
Contact:

Re: Maurer rose

Post by Otrebor »

Kwai chang caine wrote:Splendid :shock:
Very impressive the numerous line writing in few secondes
I like it too, thanks for sharing 8)
+1
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Maurer rose

Post by Saki »

Hi, yes, glad it could be of use to you.
If you want to do more in the future with graphic output,
take a closer look at the other things and also DPI aware.
The combination of WindowedScreen or screen and scalings
larger than 100% always needs a special treatment.
The more extensive a program gets the more difficult it is to adjust it afterwards.
See as sample this thread, it reflects these problems.
There you will also find some small codes for further explanation.
viewtopic.php?f=16&t=76032
地球上の平和
Post Reply