Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 500
» Latest member: protocog
» Forum threads: 2,855
» Forum posts: 26,741
Full Statistics
|
Latest Threads |
Curious if I am thinking ...
Forum: Help Me!
Last Post: SMcNeill
16 minutes ago
» Replies: 13
» Views: 86
|
ADPCM compression
Forum: Petr
Last Post: Petr
2 hours ago
» Replies: 0
» Views: 16
|
Who wants to PLAY?
Forum: QBJS, BAM, and Other BASICs
Last Post: dbox
3 hours ago
» Replies: 15
» Views: 208
|
Trojan infection !
Forum: Help Me!
Last Post: SMcNeill
4 hours ago
» Replies: 1
» Views: 31
|
Glow Bug
Forum: Programs
Last Post: PhilOfPerth
8 hours ago
» Replies: 6
» Views: 102
|
BAM Sample Programs
Forum: QBJS, BAM, and Other BASICs
Last Post: CharlieJV
Today, 02:50 AM
» Replies: 36
» Views: 1,969
|
Audio storage, stereo swi...
Forum: Programs
Last Post: Petr
Yesterday, 09:03 PM
» Replies: 8
» Views: 365
|
_CONSOLEINPUT is blocking
Forum: General Discussion
Last Post: mdijkens
Yesterday, 12:24 PM
» Replies: 7
» Views: 129
|
Most efficient way to bui...
Forum: General Discussion
Last Post: ahenry3068
01-17-2025, 11:36 PM
» Replies: 9
» Views: 137
|
QBJS - ANSI Draw
Forum: QBJS, BAM, and Other BASICs
Last Post: madscijr
01-17-2025, 11:24 PM
» Replies: 4
» Views: 135
|
|
|
could someone kindly bring me up to date with a couple qb64 items? |
Posted by: madscijr - 06-13-2022, 06:32 PM - Forum: General Discussion
- Replies (7)
|
|
I'm a little confused today... Going to qb64.com, in the Community > Forums section, there was always a link to here (which appeared last on the list, not sure why) but now it says there are no official forums for QB64, and no link to these forums at all.
Searching for answers, I wound up at
https://barnes.x10host.com/pages/BASIC-R...ources.php
where a link to these forums is first on the list.
This may be a dumb question, but I'm not entirely clear what barnes.x10host.com is for, or why all this QB64 stuff isn't under one qb64.com domain?
I realize things tend to change quickly in this crazy world of ours, and I don't follow the discord thread constantly, and maybe I missed a memo, so could someone explain what's up with that?
Also, I see the talk about the new QB 0.81. The last version of QB64 that I downloaded, before the fiasco with what's his name, was 2.0.2. I imagine that after The Jerk kicked everyone off of the forums which included the git project for the source code, that the project had to be forked or recreated or whatever it was the devs had to so, but does that mean the only code we could pick up from was from before 1.0, or did the devs decide that QB64 PE was now a different project, and decide on some beta version numbering?
I never saw a memo about the version numbering, so am not sure how that all came about.
I would think that even if we "rebranded" QB64 as "phoenix edition", that we would want to keep incrementing the version number we had, and the next release would be version 2.1.x, 3.x, or similar?
This kind of reminds me of back in the day when the marketing people for Intel started calling their CPUs Pentium, Pentium II, Pentium III, etc. instead of 586, 686, 786, etc. It's mildly annoying but as long as the stuff works right? I just want to understand how this newest version 0.81 compares to the old version 2.0.2, before upgrading...
Anyway, if anyone could please set me straight on the forums and the version numbering and which Web sites / domains are for what, it would be much appreciated!
|
|
|
HUNTER AND HUNTED |
Posted by: James D Jarvis - 06-13-2022, 01:02 PM - Forum: Programs
- Replies (2)
|
|
Hunter and Hunted is a spin on the classic text based grid hunting game Hurkle. This time it isn't just you and the Hurkle as you are also being hunted by the Bellicose Behinder. Can you find the Hurkle before the Bellicose Behinder finds you?
Code: (Select All) 'HUNTER AND HUNTED
_Title "HUNTER AND HUNTED"
Randomize Timer
Locate , 10: Print "H U N T E R A N D H U N T E D"
Print: Print: Print
Print "A Hurkle hunting game where you are both predator and prey"
Print: Print: Print
Do
eaten$ = "no": found$ = "no": n = 15: g = 20
hx = Int(Rnd * g) + 1: hy = Int(Rnd * g) + 1
'the behinder starts
b = Int(Rnd * 4)
Select Case b
Case 0:
bx = 1
by = Int(Rnd * g) + 1
Case 1:
bx = g
by = Int(Rnd * g) + 1
Case 2:
by = 1
bx = Int(Rnd * g) + 1
Case 3:
by = g
bx = Int(Rnd * g) + 1
End Select
Print "A Hurkle is hiding somwhere in a "; g; " by"; g; " grid."
Print "Homebase is at 0,0 and you must guess the hurkles location."
Print "(X is West - East, Y is North - South)"
Print "But BEWARE a BELLICOSE BEHINDER is also on the hunt..."
Print "... and you are the prey."
Print "Each turn you may enter your move as an x,y coordinate."
Print "Hints will be provided as you play."
Print
Do
Print "You have "; n; " turns left."
If (Abs(x - bx) < 3 And Abs(y - by) < 3) Or (Abs(x - hx) < 4 And Abs(y - hy) < 4) Then
Print "Something is stirring to the ";
If y < by Then Print "north";
If y > by Then Print "south";
If x < bx Then Print "east";
If x > bx Then Print "west";
Print "."
End If
Input "Where do you think the Hurkle is Hiding? ", x, y
n = n - 1
Print
If x = hx And y = hy Then
found$ = "yes"
Print "YOU FOUND THE HURKLE !"
Print
Else
Print "Look ...";
If y < hy Then Print "north";
If y > hy Then Print "south";
If x < hx Then Print "east"
If x > hx Then Print "west"
Print
End If
'there's a chance the behinder moves.... oh yeah it's coming for you
If Int(Rnd * 100) < 31 Then
Print
Print "You hear the Behinder bounding."
Print
b = Int(Rnd * 4)
Select Case b
Case 0: bx = bx - 1
Case 1: bx = bx + 1
Case 2: by = by - 1
Case 3: by = by + 1
End Select
End If
If bx = x And by = y Then
Print "OH NO !"
Print
Print "THE BELLICOSE BEHINDER HAS POUNCED ON YOU!"
Print
eaten$ = "yes"
End If
Loop Until found$ = "yes" Or n = 0 or eaten$="yes"
If found$ = "yes" Then
Print "That was just "; n; " turns!"
Else
If eaten$ = "yes" Then
Print
Print "YOUR HUNT IS OVER."
Print
Else
Print
Print "SORRY YOU DON'T HAVE ANY TURNS LEFT."
Print
End If
End If
Print
Input "Play again ? (Yes or No) ", askquit$
askquit$ = Left$(LCase$(askquit$), 1)
Loop Until askquit$ = "n"
|
|
|
Problem with User Defined Function |
Posted by: RNBW - 06-13-2022, 10:08 AM - Forum: Help Me!
- Replies (2)
|
|
When I try to compile this snippet
Code: (Select All) Type ButtonT
x As Integer 'Position left top
y As Integer
w As Integer 'Height
h As Integer 'Width
text As String 'label
End Type
Function Button(x As Integer, y As Integer, w As Integer, h As Integer, Text As String) As ButtonT
'Defines and draws a new button
Dim As ButtonT btn
btn.x = x
btn.y = y
btn.h = h
btn.w = w
btn.text = text
'Button_Draw(btn, ButtonColor)
Return btn
End Function
I get the following error:
------------------------
Expected )
Caused by (or after):
Line 9:
Function Button_New(x As Integer, y As Integer, w As Integer, h As Integer, Text As String) As Button
------------------------
Can someone clarify what I am doing wrong.
|
|
|
VM with Linux install |
Posted by: Richard - 06-12-2022, 09:06 AM - Forum: Help Me!
- Replies (16)
|
|
I have some experience with Windows + QB64.
I am now trying out LINUX (never used/studied Linux before) on a Virtual Machine (VM).
Would appreciate some help to install QB64 into VM Linux - to be able to get to a working "Hello World" program.
Thanks in advance.
|
|
|
Quaternion Rotation |
Posted by: dcromley - 06-11-2022, 03:28 AM - Forum: Programs
- Replies (5)
|
|
[ image changed, minor program improvements ] This comes from a long fascination with quaternions. I wanted to see them work.
I need to get into OpenGL/QB64. I have gone through the great tutorials of Ashish ( https://ashishkingdom.github.io/OpenGL-Tutorials/intro/ ) but he hasn't gotten to rotations. I was surprised that looking at the QB64 Wiki, that there are 7 _gl statements with "matrix" but none with "quaternion". I assume that means that OpenGL does not use quaternions?
Lord Kelvin: "Although beautiful and of ingenious origin, they have been a curse on anyone who has come into contact with them in any way."
But I had a good time.
I hope the output is somewhat obvious: there are 5 points in the figure which are rotated using the quaternion. I added the extraction of the Euler Angles at the bottom.
The program is intended to work, not to be fast. Still, I was surprised that the framerate is well above 100/sec. A credit to QB64.
Code: (Select All) _Title "Quaternion Rotation" ' dcromley
Option _Explicit
DefSng A-Z: DefLng I-N: DefStr S
Const TRUE = -1, FALSE = 0
Dim Shared mx, my, m1Clk, m1Rpt, m1Dn, m1End, m2Clk, m2Dn ' for MouseCk
Dim Shared Img1, Img2
Img1 = _NewImage(1024, 768, 256)
Img2 = _NewImage(1024, 768, 256)
_Dest Img2: Color 0, 15: Cls
_Dest Img1: Color 0, 15: Cls
' == MAIN start ==
Type type4f ' 4 floats for quaternions, points, triangles
w As Single ' 0 for points; color for triangles
x As Single ' pt1 for triangles
y As Single ' pt2 for triangles
z As Single ' pt3 for triangles
End Type
Const x0 = 384, y0 = 384, kxy = 200, z0 = 200 ' center, scale
Dim Shared As type4f T, aPts(5), aPts0(5), aTris(4), QMain, QSlew, va, vb
Dim Shared nPts, nTris ' # of Points, Triangles
Dim As type4f Qxp, Qxm, Qyp, Qym, Qzp, Qzm ' +- 1 deg Q's
Dim i, x, y, z, s, p1, p2, p3, icolor, nloop
Dim EuAngX, EuAngY, EuAngZ, fcos, fsin ' Euler angles
Dim az(4), ndx(4), time0, iSlew, xa, ya
' -- Points - x,y,z,/ (# ends)
Data 0,1,0,/,-1,-1,-1,/,-1,-1,1,/,1,-1,1,/,1,-1,-1,#
' -- Triangles - p1,p2,p3,color,/ (# ends)
Data 1,2,3,9,/,1,3,4,10,/,1,4,5,12,/,1,5,2,14,#
Do ' -- load aPoints
nPts = nPts + 1 ' read point x,y,z
Read aPts0(nPts).x, aPts0(nPts).y, aPts0(nPts).z, s ' s is / or # to end
Loop Until s = "#"
Do ' -- load aTriangles
nTris = nTris + 1 ' read triangle p1,p2,p3,color
Read aTris(nTris).x, aTris(nTris).y, aTris(nTris).z, aTris(nTris).w, s
Loop Until s = "#"
' -- load 1 deg quaternions
fcos = Cos(1 * _Pi / 360): fsin = Sin(1 * _Pi / 360) ' half angle
Qxp.w = fcos: Qxp.x = fsin: Qxm.w = fcos: Qxm.x = -fsin
Qyp.w = fcos: Qyp.y = fsin: Qym.w = fcos: Qym.y = -fsin
Qzp.w = fcos: Qzp.z = fsin: Qzm.w = fcos: Qzm.z = -fsin
QMain.w = 1 ' start with null rotation
QSlew = QMain
time0 = Timer - 1 ' prevent div by 0
Do ' ======== MAIN LOOP ========
nloop = nloop + 1 ' nloop + 1 and print
If nloop Mod 2 = 1 Then _Dest Img1: screen img1 _
Else _Dest Img2: Screen Img2 ' swap screens
Cls ' simplicity, not performance
Line (768, 0)-(768, 752), _RGB(192, 192, 192) ' vertical
MouseCk ' get mouse data
' -- check controls
If iBox(110, 12, " Up") Then Qmult Qxm, QMain, QMain ' nudge orientation
If iBox(106, 13, "Lft") Then Qmult Qym, QMain, QMain
If iBox(114, 13, "Rht") Then Qmult Qyp, QMain, QMain
If iBox(110, 14, " Dn") Then Qmult Qxp, QMain, QMain
If iBox(106, 15, "CCW") Then Qmult Qzp, QMain, QMain
If iBox(114, 15, " CW") Then Qmult Qzm, QMain, QMain
' -- check for mouse dragging (slewing)
vb.x = mx - x0: vb.y = y0 - my: vb.z = z0 ' new mouse data
If m1Dn And isIn(mx, 0, 767) And isIn(my, 0, 767) Then ' yes
QVtoV va, vb, T ' need to smooth out the mouse data
QSlew.x = QSlew.x * .9 + T.x * .1: QSlew.y = QSlew.y * .9 + T.y * .1: QSlew.z = QSlew.z * .9 + T.z * .1
Qnorm QSlew ' this is what slews
Else
Const k = .99 ' make the slewing decay
QSlew.x = QSlew.x * k: QSlew.y = QSlew.y * k: QSlew.z = QSlew.z * k
QSlew.w = Sqr(1 - QSlew.x * QSlew.x - QSlew.y * QSlew.y - QSlew.z * QSlew.z)
End If
Qmult QSlew, QMain, QMain ' add slew to QMain
va = vb ' new becomes old mouse data
' -- quaternion to Euler
EuAngX = _Atan2(2 * QMain.x * QMain.w - 2 * QMain.y * QMain.z, 1 - 2 * QMain.x * QMain.x - 2 * QMain.z * QMain.z)
EuAngY = _Atan2(2 * QMain.y * QMain.w - 2 * QMain.x * QMain.z, 1 - 2 * QMain.y * QMain.y - 2 * QMain.z * QMain.z)
EuAngZ = _Asin(2 * QMain.x * QMain.y + 2 * QMain.z * QMain.w)
' -- rotate points
For i = 1 To nPts
aPts(i) = aPts0(i) ' reset to original
T = QMain
T.x = -T.x: T.y = -T.y: T.z = -T.z: ' << Q' >> conjugate
Qmult aPts(i), T, T ' << PQ' >>
Qmult QMain, T, aPts(i) ' << QPQ' >>
Next i
For i = 1 To 4 ' get center Z's into a(4)
T = aTris(i)
az(i) = aPts(T.x).z + aPts(T.y).z + aPts(T.z).z ' p1.z+p2.z+p3.z
Next i
zSortIndexF az(), ndx() ' getting z-order
For i = 1 To nTris ' this draws the triangles
drawTri (ndx(i)) ' in z-order
Next i
' -- print stuff
Locate 2, 101: Print Using "nloops:#,###,###,###"; nloop
Locate , 101: Print Using "fps: ####.#"; nloop / (Timer - time0)
Locate , 104: Print
Locate , 104: Print "-- To rotate --"
Locate , 104: Print "1) Click boxes"
Locate , 104: Print "2) Press boxes"
Locate , 104: Print "3) Drag mouse"
Locate , 104: Print "ESC to end"
Locate 19, 102: Print " -- Quaternion --"
Locate , 99: Print Using " ##.#####"; QMain.w
Locate , 99: Print Using " ##.#####"; QMain.x; QMain.y; QMain.z
' Locate , 99: Print Using " ##.#####"; QSlew.w
' Locate , 99: Print Using " ##.#####"; QSlew.x; QSlew.y; QSlew.z
Locate , 100: Print ""
Locate , 102: Print " -- Points --"
For i = 1 To nPts
Locate , 99: Print Using " ##.#####"; aPts(i).x; aPts(i).y; aPts(i).z
Next i
Locate , 100: Print ""
Locate , 102: Print " -- Euler Angles --"
Locate , 100: Print Using "EuAngX: ###"; (EuAngX * 180 / _Pi + 360) Mod 360
Locate , 100: Print Using "EuAngY: ###"; (EuAngY * 180 / _Pi + 360) Mod 360
Locate , 100: Print Using "EuAngZ: ###"; (EuAngZ * 180 / _Pi + 360) Mod 360
_Display
Loop Until InKey$ = Chr$(27)
System
' == ROUTINES start ==
Function iBox (iCol, iRow, s3) ' simple control
Dim ix, iy
Locate iRow, iCol: Color 0, 14: Print s3;: Color 0, 15
ix = iCol * 8 - 11
iy = iRow * 16 - 1
Line (ix, iy)-(ix + 3 * 8 + 4, iy - 16), , B ' rectangle
If m1Rpt And isIn(mx, ix, ix + 28) And isIn(my, iy - 16, iy) Then iBox = TRUE
End Function
Sub Qmult (qa As type4f, qb As type4f, qab As type4f) ' Q multiplication
Dim w, x, y, z
w = qa.w * qb.w - qa.x * qb.x - qa.y * qb.y - qa.z * qb.z
x = qa.w * qb.x + qa.x * qb.w + qa.y * qb.z - qa.z * qb.y
y = qa.w * qb.y - qa.x * qb.z + qa.y * qb.w + qa.z * qb.x
z = qa.w * qb.z + qa.x * qb.y - qa.y * qb.x + qa.z * qb.w
qab.w = w: qab.x = x: qab.y = y: qab.z = z
End Sub
Sub QVtoV (v1 As type4f, v2 As type4f, Q As type4f) ' get Q from v1 to v2
Dim v1dv2, v1xv2 As type4f ' dot, cross
v1dv2 = VdotV(v1, v2) ' dot
VcrossV v1, v2, Q ' cross
Q.w = v1dv2 + Sqr(v1dv2 * v1dv2 + VdotV(Q, Q)) ' from the book
Qnorm Q
End Sub
Function VdotV (v1 As type4f, v2 As type4f) ' dot product
VdotV = v1.x * v2.x + v1.y * v2.y + v1.z * v2.z
End Function
Sub VcrossV (v1 As type4f, v2 As type4f, v As type4f) ' cross product
v.x = v1.y * v2.z - v1.z * v2.y
v.y = v1.z * v2.x - v1.x * v2.z
v.z = v1.x * v2.y - v1.y * v2.x
End Sub
Sub Qnorm (q As type4f) ' normalize
Dim d
d = Sqr(q.w * q.w + q.x * q.x + q.y * q.y + q.z * q.z)
q.w = q.w / d: q.x = q.x / d: q.y = q.y / d: q.z = q.z / d
End Sub
Sub drawTri (iTri) ' draw Triangle
Dim ip1, ip2, ip3, icolor
Dim ixc, iyc, x1, y1, x2, y2, x3, y3
T = aTris(iTri) ' the triangle
ip1 = T.x: ip2 = T.y: ip3 = T.z: icolor = T.w ' the points, color
x1 = 386 + kxy * aPts(ip1).x: y1 = 386 - kxy * aPts(ip1).y
x2 = 386 + kxy * aPts(ip2).x: y2 = 386 - kxy * aPts(ip2).y
x3 = 386 + kxy * aPts(ip3).x: y3 = 386 - kxy * aPts(ip3).y
Line (x1, y1)-(x2, y2), icolor
Line (x2, y2)-(x3, y3), icolor
Line (x3, y3)-(x1, y1), icolor
' don't paint if points are colinear
If Abs(x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) < 1000 Then Exit Sub
ixc = (x1 + x2 + x3) / 3: iyc = (y1 + y2 + y3) / 3 ' center
Paint (ixc, iyc), icolor ' paint
End Sub
' -- LIBRARY ROUTINES --
' -- need Dim Shared mx,my,m1Clk,m1Rpt,m1Dn,m1End,m2Clk,m2Dn
Sub MouseCk () ' get mouse info
Static m1Prev, m2Prev, m1Time ' for getting edges (Clk,End) and Repeating
m1Clk = 0: m1Rpt = 0: m1End = 0: m2Clk = 0
While _MouseInput: Wend ' bplus
mx = _MouseX: my = _MouseY: m1Dn = _MouseButton(1): m2Dn = _MouseButton(2)
If m1Dn Then ' Btn 1 down
If Not m1Prev Then ' got a Clk (& Rpt), now look for repeats
m1Clk = TRUE: m1Rpt = TRUE: m1Time = iMsecs + 250 ' delay 1/4 sec for repeats
Else ' has been down, ck for repeat
If iMsecs > m1Time Then m1Rpt = TRUE: m1Time = iMsecs + 50 ' repeat 20/sec
End If
m1Prev = TRUE
Else ' Btn 1 up
If m1Prev Then m1End = TRUE ' end of downtime (upedge)
m1Prev = FALSE ' for next time
End If
If m2Dn Then ' Btn 2 down
If Not m2Prev Then m2Clk = TRUE ' click (downedge)
m2Prev = TRUE
Else
m2Prev = FALSE
End If
End Sub
Function isIn (x, a, b) ' ck between
If x >= a And x <= b Then isIn = TRUE
End Function
Sub zSortIndexF (a(), ndx()) ' make index to a()
Dim i, j, t
For i = 1 To UBound(a) ' add one at a time
t = a(i) ' to be added
For j = i To 2 Step -1 ' merge in
If a(ndx(j - 1)) <= t Then Exit For
ndx(j) = ndx(j - 1)
Next j
ndx(j) = i
Next i
End Sub
Function iMsecs () ' milliseconds since midnight UTC
iMsecs = Int(Timer(.001) * 1000 + .5)
End Function
___________________________________________________
"I don't understand all I know about quaternions."
|
|
|
Old Games |
Posted by: johnno56 - 06-11-2022, 02:02 AM - Forum: General Discussion
- Replies (6)
|
|
Hey guys,
I am looking for some old "text based" games in Basic that do not use "goto"... (some goto's I can convert but not all...)
Such as Mastermind; Yahtzee; Farkle etc
Thank you.
J
ps: Sucker for the classics... lol
|
|
|
Trojan in 0.8? |
Posted by: James D Jarvis - 06-11-2022, 01:05 AM - Forum: General Discussion
- Replies (9)
|
|
I just had QB64 phoenix 0.8 throw an alert about an internal IDE error and windows threw up a Trojan alert at the same time. I was creating a simple screen mode 0 program at the time. I was using the 0.8 build that came with the download.
|
|
|
Compiler settings |
Posted by: BG 7 - 06-10-2022, 12:05 PM - Forum: Help Me!
- Replies (1)
|
|
Last time the size of our freeware backgammon program
compiled with QB64 v.2.01 was 20.972.544
compiled with QB64pe v.0.80 was 20.987.902
Although the exe-file is a little bit bigger I believe that the time for compilation
was shorter with QB64pe v.0.80.
Concerning QB64 Phoenix Edition 0.80:
are there any (new) settings in order to optimize compiling
resulting in smaller (or faster) exe-files ?
Where can I find any pieces of information about compiler settings ?
Thanks !
|
|
|
|