|
Post by Gordon Rahman on May 20, 2022 10:50:19 GMT -5
Are there "easy" fixes for next versions of LB5?
Example: Reading a Window variable in the LB4-style looks like LBVar = _ABCD_EFG For instances the XOR in LB4 is _R2_NOTXORPEN (10) This looks like an easy fix in LB5 for the Windows platform. But it might be difficult to do in the other platforms.
Another example: To scale a picture (png,jpg,bmp and so on) .... allready exist in LB5. and I think in all the other platforms too ...? Windows-platform allready knows SPRITES and I think the other platforms too...? Is scaling difficult?
The Windows platform already knows 4 Cursors, the 5th (Hand) is missing. I think the other platforms too? Is this an easy fixing?
This "Thread is not only for Carl , ... but I don't have computers with the "other" platforms. So can we find a way to help here?
Gordon
|
|
|
Post by Gordon Rahman on May 20, 2022 13:14:32 GMT -5
nomainwin filedialog "Search for any WAV sound-file","*.*",w$ wavefile$ = w$ playMode = 1
open "Play the MUSIC" for window as #aWindow calldll #winmm, "sndPlaySoundA", wavefile$ as ptr, playMode as long, result as long wait
This easy in Windows, but maybe not so easy in the other platform?
Gordon
|
|
|
Post by Gordon Rahman on May 23, 2022 12:50:10 GMT -5
nomainwin WindowWidth = 440 WindowHeight = 440 UpperLeftX = 100 UpperLeftY = 100
loadbmp "bg3","fawaka\doolhof1.bmp"
'het venster open "Rubberbandje tussen muis en startpunt" for graphics_nf_nsb as #w #w "drawbmp bg3 0 0" #w "size 4" #w "backcolor green" #w "down; rule XOR" #w "when leftButtonDown [startpunt]" #w "when leftButtonMove [dragline]" #w "when leftButtonUp [eindpunt]" wait
[startpunt] startx = MouseX : starty = MouseY lastx = MouseX : lasty = MouseY #w "place ";startx;" ";starty #w "circlefilled 10" wait
[dragline] #w "line ";startx;" ";starty;" ";lastx;" ";lasty #w "line ";startx;" ";starty;" ";MouseX;" ";MouseY lastx = MouseX : lasty = MouseY wait
[eindpunt] #w "place ";lastx;" ";lasty #w "circlefilled 10" wait
This works perfect with LB5.
nomainwin WindowWidth = 440 WindowHeight = 440 UpperLeftX = 100 UpperLeftY = 100
loadbmp "bg3","fawaka\doolhof1.bmp"
'het venster open "Rubberbandje tussen muis en startpunt" for graphics_nsb as #w #w drawbmp("bg3", 0, 0) #w size(4) #w backcolor("green") #w color("black") '#w "down" '#w rule("xor") '10" ' xor unrecognized command rule() '#w "rule xor" 'no error but nothing happens #w when("leftButtonDown [startpunt]") #w when("leftButtonMove [dragline]") #w when("leftButtonUp [eindpunt]") wait
[startpunt] '#w "down" #w "rule xor" startx = MouseX : starty = MouseY lastx = MouseX : lasty = MouseY #w place(startx , starty) #w circlefilled(0) wait
[dragline] #w line(startx,starty,lastx,lasty) #w line(startx,starty,MouseX,MouseY) lastx = MouseX : lasty = MouseY wait
[eindpunt] '#w "rule xor" #w place(lastx,lasty) #w circlefilled(10) wait
This doesn't work in LB5
I'm astonished ... Easy fix? or am I doing something wrong here?
|
|
|
Post by Carl Gundel on May 23, 2022 17:26:24 GMT -5
The RULE() function isn't implemented yet. The following works for me.
nomainwin WindowWidth = 440 WindowHeight = 440 UpperLeftX = 100 UpperLeftY = 100
loadbmp "bg3","fawaka\doolhof1.bmp"
'het venster open "Rubberbandje tussen muis en startpunt" for graphics_nf_nsb as #w #w drawbmp("bg3", 0, 0) #w size(4) #w backcolor("green") #w down() #w "rule XOR" #w when("leftButtonDown", "[startpunt]") #w when("leftButtonMove", "[dragline]") #w when("leftButtonUp", "[eindpunt]") wait
[startpunt] startx = MouseX : starty = MouseY lastx = MouseX : lasty = MouseY #w place(startx, starty) #w circlefilled(10) wait
[dragline] #w line(startx, starty, lastx, lasty) #w line(startx, starty, MouseX, MouseY) lastx = MouseX : lasty = MouseY wait
[eindpunt] #w place(lastx, lasty) #w circlefilled(10) wait
|
|
|
Post by Gordon Rahman on May 24, 2022 11:00:39 GMT -5
Oops, I have no excuses for my blunder with the when("","") command function. I did look for that function back untill version LB5_264 ... and didn't found an example. But my biggest mistake was that I placed a rem before the statement #w "down" in my LB5 listing while using a LB4 statement!!! to draw graphics. So untill XOR is implemented we can use "rule xor" and don't forget to use a pen down command too. Thanks for the great things you're doing Carl. Gordon
|
|
|
Post by Marco Kurvers on May 24, 2022 11:22:06 GMT -5
I thought for a moment that the bracket open behind the WHEN command had to be moved behind 'leftButtonDown', but when I see Carl's answer that it works, it was not because of that.
|
|
|
Post by Carl Gundel on May 24, 2022 13:27:18 GMT -5
Oops, I have no excuses for my blunder with the when("","") command function. I did look for that function back untill version LB5_264 ... and didn't found an example. I actually want to make the quotes optional around branch labels and subroutine names, but that may not make it in until v5.1. 'currently #handle when("eventName", "[handler]") 'ideally #handle when("eventName", [handler]) 'or even more ideally #handle when(eventName, [handler]) 'and perhaps this makes sense #handle when(EVENTNAME, [handler]) In the last example the compiler would replace EVENTNAME to be a string for that token. Of course if we start adding new concepts for language tokens this might be confusing for some, so I'll chew on that some more. The down() is optional in LB5. The default pen state now is always initially down because it is very rare that it should be up.
|
|
|
Post by Gordon Rahman on Jun 1, 2022 8:14:56 GMT -5
This may not be an easy fix.... But I'm puzzled ....
nomainwin WindowWidth = 440 WindowHeight = 440 UpperLeftX = 100 UpperLeftY = 100
loadbmp "bg3","fawaka\doolhof1.bmp"
'het venster open "Rubberbandje tussen muis en startpunt" for graphics_nf_nsb as #w #w drawbmp("bg3", 0, 0) #w size(4) #w backcolor("green") #w color("black") '#w "down" '#w rule("xor") '10" ' xor unrecognized command rule() #w "down; rule XOR" 'no error but nothing happens #w when("leftButtonDown","[startpunt]") #w when("leftButtonMove","[dragline]") #w when("leftButtonUp","[eindpunt]") wait
[startpunt] '#w "down" '#w "rule xor" startx = MouseX : starty = MouseY lastx = MouseX : lasty = MouseY #w place(startx , starty) #w circlefilled(10) wait
[dragline] #w line(startx,starty,lastx,lasty) #w line(startx,starty,MouseX,MouseY) lastx = MouseX : lasty = MouseY wait
[eindpunt] '#w "rule xor" #w place(lastx,lasty) #w circlefilled(10) wait
This listing above works as expected!
nomainwin ndowWidth = 440 WindowHeight = 440 UpperLeftX = 100 UpperLeftY = 100
global startx,starty,lastx,lasty loadbmp "bg3","fawaka\doolhof1.bmp"
'het venster open "Rubberbandje tussen muis en startpunt" for graphics_nf_nsb as #w #w drawbmp("bg3", 0, 0) #w size(4) #w backcolor("green") #w color("black") '#w "down" 'down() #w "down; rule XOR" #w when("leftButtonDown", "startpunt") #w when("leftButtonMove", "dragline") #w when("leftButtonUp", "eindpunt")
#w setfocus() wait
sub startpunt h$,Mx,My #w setfocus() #w when("leftButtonDown", "") 'startx = MouseX : starty = MouseY startx = Mx:starty = My lastx = MouseX : lasty = MouseY 'lastx = Mx : lasty = My #w place(startx,starty) #w circlefilled(10) end sub
sub dragline 'h$,Mx,My #w line(startx,starty,lastx,lasty) #w line(startx, starty, MouseX, MouseY) lastx = MouseX :lasty = MouseY end sub
sub eindpunt h$,Mx,My '#w down() 'lastx = MouseX : lasty = MouseY 'lastx = Mx : lasty = My 'print lastx,MouseX,Mx 'print lasty,MouseY,My #w place(lastx,lasty) '#w "down" #w circlefilled(10) end sub
Just place your mouse on the bmp and draw a line .... To see the expected line ... just click on the listing!!!! to see the finishing touch !!!
Gordon
|
|
|
Post by Carl Gundel on Jun 1, 2022 13:11:52 GMT -5
This may not be an easy fix.... But I'm puzzled .... <snipped> Just place your mouse on the bmp and draw a line .... To see the expected line ... just click on the listing!!!! to see the finishing touch !!! Your two examples are a lot different. Here, I've converted your first example to use SUBs as straight as possible. Works fine, except that there is some glitch in the graphical validation code. I'm sure that's an easy fix. nomainwin WindowWidth = 440 WindowHeight = 440 UpperLeftX = 100 UpperLeftY = 100
global startx, starty, lastx, lasty loadbmp "bg3","fawaka\doolhof1.bmp"
'het venster open "Rubberbandje tussen muis en startpunt" for graphics_nf_nsb as #w #w drawbmp("bg3", 0, 0) #w size(4) #w backcolor("green") #w color("black") #w "down; rule XOR" #w when("leftButtonDown","startpunt") #w when("leftButtonMove","dragline") #w when("leftButtonUp","eindpunt") wait
sub startpunt h$, x, y startx = x : starty = y lastx = x : lasty = y #w place(startx , starty) #w circlefilled(10) end sub
sub dragline h$, x, y #w line(startx,starty,lastx,lasty) #w line(startx,starty,x,y) lastx = x : lasty = y end sub
sub eindpunt h$, x, y '#w "rule xor" #w place(lastx,lasty) #w circlefilled(10) end sub
|
|
|
Post by Gordon Rahman on Jun 1, 2022 18:04:35 GMT -5
Tanks in advance Carl.
I like the pace of the LB5 development. I only have 21 commands left for LB5 to finish... besides the Comm port commands, the Joystick commands and some Sprite commands (scaling and travelxy)
I like the extras like .. we can test for MouseX and MouseY apart from them being a mouse-EVENT parameter.
Gordon.
|
|
|
Post by Gordon Rahman on Jun 26, 2022 15:28:35 GMT -5
Please don't forget the POSXY graphic command that gives the current character print pen-position on the screen.
From the LB4 help file: This command positions the pen at X Y. No graphics will be drawn, even if the pen is DOWN. print #handle, "posxy xVar yVar"
Easy fix?
Gordon
|
|
|
Post by Rod on Jun 27, 2022 1:29:32 GMT -5
I thought posxy returned the pen position and place x y set the pen position.
|
|
|
Post by Marco Kurvers on Jul 1, 2022 16:22:01 GMT -5
Yes Rod, you have right. I told Gordon that "posxy x y" gets the pen position. Only "place x y" sets the pen. In version 5, we can type this:
x1 = 100
y1 = 100
x2 = 0
y2 = 0
open "" for graphics as #g
#g trapclose("Quit")
#g place(x1 + 50, y1 + 50)
#g "posxy x2 y2"
#g "|"; str$(x2); " "; str$(y2)
wait
sub Quit handle$
close #g
end
end sub
I have discovered that although POSXY does get the correct syntax color, it does not yet run in the Build 353 version. It would also be useful to be able to render text graphically in the future without the pipe character, because now the properties are no longer used in quotation marks.
I thought I should program POSXY in version 5 like this:
#g posxy(x2, y2)
If Carl can do this, de parameters must be byref.
|
|
|
Post by Gordon Rahman on Aug 2, 2022 17:07:07 GMT -5
Oops .... posxy is already implemented ... in x() and y() ?? WindowWidth = 800 WindowHeight = 600 open "posxy test" for graphics as #1 #1 when("leftButtonMove","moved") #1 trapclose("[quit]") #1 home() print #1 x() a = #1 x() print "a = ";a print #1 y() wait
sub moved h$,x,y print "moved to ";x,y print #1 x(), #1 y() end sub
[quit] close #1 end
Gordon
|
|
|
Post by Gordon Rahman on Aug 2, 2022 17:40:24 GMT -5
Here is another easy fix ... I think. Don't forget a timer here ...?
'nomainwin WindowWidth = 615 WindowHeight = 715
UpperLeftX = (DisplayWidth-WindowWidth)/2 UpperLeftY = (DisplayHeight-WindowHeight)/2
global cel cel=1
dim kleur$(16) kleur$(1) = "yellow" kleur$(2) = "brown" kleur$(3) = "red" kleur$(4) = "darkred" kleur$(5) = "pink" kleur$(6) = "darkpink" kleur$(7) = "blue" kleur$(8) = "darkblue" kleur$(9) = "green" kleur$(10) = "darkgreen" kleur$(11) = "cyan" kleur$(12) = "darkcyan" kleur$(13) = "white" kleur$(14) = "black" kleur$(15) = "lightgray" kleur$(16) = "darkgray"
open "Simon game" for graphics as #g #g when("leftButtonDown","punt")
#g place(020,020) #g box(180,180) #g place(220,020) #g box(380,180) #g place(420,020) #g box(580,180)
#g place(020,220) #g box(180,380) #g place(220,220) #g box(380,380) #g place(420,220) #g box(580,380)
#g place(020,420) #g box(180,580) #g place(220,420) #g box(380,580) #g place(420,420) #g box(580,580) wait
sub punt h$,Mx,My Vx = int(Mx/200) Vy = int(My/200) cel = (Vx+1)+(3*Vy) print "cel = ";cel
select case cel case 1 calldll #kernel32, "Beep", 360 As Long, 320 As long, r As boolean 'C #g backcolor(kleur$(4)) #g place(020,020) #g boxfilled(180,180)
timer 1,[g1] wait [g1] timer 0
case 2 calldll #kernel32, "Beep", 400 As Long, 400 As Long, r As boolean 'C #g backcolor(kleur$(7)) #g place(220,020) #g boxfilled(380,180)
timer 1,[g2] wait [g2] timer 0
case 3 calldll #kernel32, "Beep", 450 As Long, 400 As Long, r As Long #g backcolor(kleur$(9)) #g place(420,020) #g boxfilled(580,180)
timer 1,[g3] wait [g3] timer 0
case 4 calldll #kernel32, "Beep", 490 As Long, 400 As Long, r As Long #g backcolor(kleur$(5)) #g place(020,220) #g boxfilled(180,380)
timer 1,[g4] wait [g4] timer 0
case 5 calldll #kernel32, "Beep", 540 As Long, 400 As Long, r As Long #g backcolor(kleur$(1)) #g place(220,220) #g boxfilled(380,380)
timer 1,[g5] wait [g5] timer 0
case 6 calldll #kernel32, "Beep", 600 As Long, 400 As Long, r As Long #g backcolor(kleur$(6)) #g place(420,220) #g boxfilled(580,380)
timer 1,[g6] wait [g6] timer 0
case 7 calldll #kernel32, "Beep", 710 As Long, 400 As Long, r As Long 'C #g backcolor(kleur$(10)) #g place(020,420) #g boxfilled(180,580)
timer 320,[g7] wait [g7] timer 0
case 8 calldll #kernel32, "Beep", 800 As Long, 400 As Long, r As Long 'C #g backcolor(kleur$(3)) #g place(220,420) #g boxfilled(380,580)
timer 1,[g8] wait [g8] timer 0
case 9 calldll #kernel32, "Beep", 900 As Long, 400 As Long, r As Long 'C #g backcolor(kleur$(8)) #g place(420,420) #g boxfilled(580,580)
timer 1,[g9] wait [g9] timer 0
end select end sub
wait
|
|