Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 714
» Latest member: HenryG
» Forum threads: 3,569
» Forum posts: 31,908

Full Statistics

Latest Threads
4x4 Square Elimination Pu...
Forum: bplus
Last Post: bplus
24 minutes ago
» Replies: 12
» Views: 390
Container Data Structure
Forum: Utilities
Last Post: bplus
37 minutes ago
» Replies: 3
» Views: 86
Accretion Disk
Forum: Programs
Last Post: bplus
48 minutes ago
» Replies: 11
» Views: 239
QB64PE v 4.4.0
Forum: Announcements
Last Post: Unseen Machine
8 hours ago
» Replies: 7
» Views: 650
QBJS v0.10.0 - Release
Forum: QBJS, BAM, and Other BASICs
Last Post: Unseen Machine
8 hours ago
» Replies: 13
» Views: 1,279
Arrays inside Types?
Forum: General Discussion
Last Post: hsiangch_ong
9 hours ago
» Replies: 47
» Views: 1,394
Has anybody experience wi...
Forum: Help Me!
Last Post: Rudy M
Yesterday, 08:47 AM
» Replies: 31
» Views: 1,933
Sorting numbers - FiliSor...
Forum: Utilities
Last Post: PhilOfPerth
03-11-2026, 12:48 AM
» Replies: 11
» Views: 303
Quick Sort for variable l...
Forum: Utilities
Last Post: SMcNeill
03-10-2026, 03:14 PM
» Replies: 3
» Views: 87
Ready for Easter!
Forum: Holiday Code
Last Post: bplus
03-10-2026, 12:15 PM
» Replies: 0
» Views: 51

 
  WTH Happened to this forum screen?
Posted by: bplus - 02-18-2026, 12:26 AM - Forum: Site Suggestions - Replies (1)

All of sudden this forum screen went giant sized so that I have to scroll to right to see the right side of the screen???

Yikes! How can I undo this?



Attached Files Thumbnail(s)
   
Print this item

  _SaveImage less then 32BPP
Posted by: mdijkens - 02-17-2026, 12:47 PM - Forum: Help Me! - Replies (7)

I've never ran into this, but it seems _SaveImage cannot save a PNG image with less then 32 bits per pixel?
I have a large image _NewImage(15000, 15000, 11) just black and white.
But saving it takes 22 seconds and is ~8MB
When externally converting to 1BPP PNG it is only 700KB

Is there a (fast) way to do this in Qb64pe ?

Print this item

  _NEWIMAGE can't accept variables as dimensions?
Posted by: bobalooie - 02-17-2026, 12:59 AM - Forum: Help Me! - Replies (23)

I am working on a project in which I would like to create images using _NEWIMAGE and calculated image dimensions. I have found that an 'Illegal Function Call' error is raised when I try to create an image like this:

DIM AS LONG Pict
DIM AS INTEGER iy
.
.
.
Pict =_NEWIMAGE(64, iy, 32)

Does _NEWIMAGE accept only numeric values for the dimensions? The wiki doesn't specifically say so but all of the examples use numeric dimension values. 

TIA

Print this item

  QBJS Sample fix(es)
Posted by: bplus - 02-16-2026, 01:38 PM - Forum: QBJS, BAM, and Other BASICs - Replies (5)

@dbox going through samples (boy that link to tutorial was helpful!) I see an obvious quick fix to improve the Draw Contest Sample authored by yours truely.

quick fix for QBJS sample Draw Contest:

Code: (Select All)
' Mod MG DRAW by bplus 2023-10-08
'ref  https://qb64.boards.net/thread/219/qb64-dev-competition-idea?page=2&scrollTo=1228
Dim i As Integer, ai As Integer, cc As Integer, u As Integer
Dim a$, s$
Randomize Timer
Screen _newimage(800, 600, 12)
Do
    a$ = ""
    Do Until Len(a$) > 20
        If Random1(2) = 1 Then
            If Random1(2) = 1 Then a$ = a$ + "L" Else a$ = a$ + "R"
        Else
            If Random1(2) = 1 Then a$ = a$ + "D" Else a$ = a$ + "U"
        End If
        a$ = a$ + Str$(Rand(1, 15))
    Loop
    s$ = a$
    Cls
    For i = 1 To 24
        stepper = Val(Mid$(" 10 12 15 18 20 30 40 45 60 72 90120180", Int(Rnd * 13) + 1, 3))
        For ai = 0 To 360 - stepper Step stepper
            cc = Rand(64, 160)
            If i > 10 Then u = 10 Else u = i
            If i Mod 2 Then cc = 9 Else cc = 15
            PreSet (400, 300)
            'Draw "ta0"  ' this needed?
            a$ = "S" + Str$(22 - u * 2) + "TA" + Str$(ai) + "C" + Str$(cc) + s$
            Draw a$
        Next
    Next
    Print "spacebar for another, esc to quit"
    Sleep
Loop Until Asc(InKey$) = 27
Function Rand& (fromval&, toval&)
    Dim sg%, f&, t&
    If fromval& = toval& Then
        Rand& = fromval&
        Exit Function
    End If
    f& = fromval&
    t& = toval&
    If (f& < 0) And (t& < 0) Then
        sg% = -1
        f& = f& * -1
        t& = t& * -1
    Else
        sg% = 1
    End If
    If f& > t& Then Swap f&, t&
    Rand& = Int(Rnd * (t& - f& + 1) + f&) * sg%
End Function
Function Random1& (maxvaluu&)
    Dim sg%
    sg% = Sgn(maxvaluu&)
    If sg% = 0 Then
        Random1& = 0
    Else
        If sg% = -1 Then maxvaluu& = maxvaluu& * -1
        Random1& = Int(Rnd * maxvaluu& + 1) * sg%
    End If
End Function

Gets it out of tiny screen 13 and centered in normal sized screen much more enjoyable to stretch drawing out.

Now I got to see why this isn't working in QB64pe but so much better in QBJS, I suspect screen new image needs 12 not 32.

Update again: yep that was it! Now fixed for both QB64pe and QBJS see code run below.

Update still again, helpful hint: note to quit run hit escape as instructed, that puts you back in forum, but if your screen is like mine you need to know you have to scroll up on forum page to see you are really escaped from QBJS.

Print this item

  Mac print #file crlf?
Posted by: BlameTroi - 02-15-2026, 11:08 PM - Forum: Help Me! - Replies (5)

Two questions:

First, should I be entering an issue over on github for this sort of thing?

Second: Running on Mac I'm printing to a text file and the end of line is crlf but should be lf. I see that the doc says print will add a crlf. Is there any way to turn this off. I started looking at the C++ code and decided this was one I couldn't begin to tackle on my own Smile

Print this item

  code locks up when SHELL
Posted by: paulel - 02-15-2026, 06:36 PM - Forum: Help Me! - Replies (4)

i'm trying my programs on a different computer.
the programs frequently lock up when running the SHELL command, typically when executing "notpad.exe" or starting a .BAT file.
the other pc is running Windows 11 Home
they run just fine on my laptops, one runs Windows 11 the other 10.

any thoughts or suggestions?

Print this item

  Valentine's Beating Heart
Posted by: SMcNeill - 02-15-2026, 05:51 PM - Forum: Holiday Code - Replies (31)

Inspired by @bplus and his Valentine Heart, I had to make one as well.  

My heart beats for you guys!

Code: (Select All)
Screen _NewImage(800, 600, 32)
_Title "Valentine Heart — QB64PE"

Const TWO_PI = 6.283185307
Dim Shared Particles(1 To 300) As Particle

Type Particle
    x As Single
    y As Single
    dx As Single
    dy As Single
    life As Single
    col As _Unsigned Long
End Type


'-----------------------------------------
' Main loop
'-----------------------------------------
Dim t As Single, beat As Integer
Do
    Cls , _RGB32(10, 10, 20)

    t = t + .05
    Dim scale As Single
    scale = 8 + Sin(t) * 1.5

    ' Glow layers
    DrawHeart 400, 300, scale * 1.25, _RGBA32(255, 0, 80, 40)
    DrawHeart 400, 300, scale * 1.15, _RGBA32(255, 0, 120, 60)
    DrawHeart 400, 300, scale, _RGB32(255, 0, 180)

    ' Beat detection
    If Sin(t) > .95 And beat = 0 Then
        Burst 400, 300
        beat = 1
    End If
    If Sin(t) < .5 Then beat = 0

    UpdateParticles

    _Display
    _Limit 60
Loop

'-----------------------------------------
' Draw a parametric heart at scale S
'-----------------------------------------
Sub DrawHeart (cx As Single, cy As Single, s As Single, col As _Unsigned Long)
    Dim t As Single, x As Single, y As Single
    For t = 0 To TWO_PI Step .01
        x = 16 * Sin(t) ^ 3
        y = -(13 * Cos(t) - 5 * Cos(2 * t) - 2 * Cos(3 * t) - Cos(4 * t))
        PSet (cx + x * s, cy + y * s), col
    Next
End Sub

'-----------------------------------------
' Spawn particle burst
'-----------------------------------------
Sub Burst (cx As Single, cy As Single)
    Dim i As Integer
    For i = 1 To 300
        Particles(i).x = cx
        Particles(i).y = cy
        Dim a As Single
        a = Rnd * TWO_PI
        Particles(i).dx = Cos(a) * (Rnd * 4)
        Particles(i).dy = Sin(a) * (Rnd * 4)
        Particles(i).life = 1
        Particles(i).col = _RGB32(255, 50 + Rnd * 150, 200)
    Next
End Sub

'-----------------------------------------
' Update and draw particles
'-----------------------------------------
Sub UpdateParticles
    Dim i As Integer
    For i = 1 To 300
        If Particles(i).life > 0 Then
            Particles(i).x = Particles(i).x + Particles(i).dx
            Particles(i).y = Particles(i).y + Particles(i).dy
            Particles(i).life = Particles(i).life - .01
            Dim a As Integer
            a = 255 * Particles(i).life
            Line (Particles(i).x, Particles(i).y)-Step(2, 2), _RGBA32(255, 100, 200, a), BF
        End If
    Next
End Sub

Print this item

  Happy Valentine's Day!
Posted by: bplus - 02-15-2026, 02:56 AM - Forum: Programs - Replies (12)

Inspired by Charlies BAM take on RR of BBC Conic Shape:
https://qb64phoenix.com/forum/showthread...3#pid39873

Code: (Select All)
_Title "Cardiac Conic Shape" 'b+ 2026-02-14
' inspired by CharlieJV BAM version of Richard Russle
' also inspired by today being Valentine's Day

Const xmax = 800, ymax = 600
Screen _NewImage(xmax, ymax, 32)
_ScreenMove 150, 50
Dim Shared blades: blades = 48
Dim Shared hX(1 To blades), hY(1 To blades)
Dim Shared OCX(1 To blades), OCY(1 To blades)
Dim pal~&(1 To blades)
For i = 1 To blades
    pal~&(i) = _RGB32(255, (blades - i) / blades * 64 + 64, i / blades * 255)
Next
i = 0
' BIG outer circle map points from bottom of screen like heart is mapped
CX = xmax / 2
CY = ymax / 2
BigCircRadius = ymax / 2 - 10
'map the outer circle OCX, OCY points  once and for all time!
For a = _Pi(.5) To _Pi(2.5) - .001 Step _Pi(2 / blades)
    i = i + 1
    OCX(i) = CX + BigCircRadius * Cos(a)
    OCY(i) = CY + BigCircRadius * Sin(a)
Next

' heart
hCircRadius = .15 * BigCircRadius
a = -_Pi
While _KeyDown(27) = 0
    Cls
    ' recalc heart points from new position
    hOrigX = CX + hCircRadius * Cos(a)
    hOrigY = CY + hCircRadius * Sin(a)
    MapHeart hOrigX, hOrigY, 12
    ' draw line from center to heart point
    For i = 1 To blades
        Line (CX, CY)-(hX(i), hY(i))
        ' and line from heart point to outer circle
        Line (hX(i), hY(i))-(OCX(i), OCY(i))
        If (i Mod 2 = 0) Then
            Color pal~&(i - 1)
            Line (hX(i), hY(i))-(hX(i - 1), hY(i - 1))
            Line (OCX(i), OCY(i))-(OCX(i - 1), OCY(i - 1))
        End If
    Next
    _Display
    _Limit 30
    a = a + _Pi(1 / 45)
    If a > _Pi Then a = -_Pi
Wend


'Reference and thanks to:
' http://mathworld.wolfram.com/HeartCurve.html
' find the 6th heart curve equations #7, 8
Function xCard (t)
    xCard = 16 * Sin(t) ^ 3
End Function

Function yCard (t)
    yCard = 13 * Cos(t) - 5 * Cos(2 * t) - 2 * Cos(3 * t) - Cos(4 * t)
End Function

Sub MapHeart (cx, cy, magnify)
    ' dim shared hX, hY 1 to blades
    For a = -_Pi To _Pi - .001 Step _Pi(2 / blades)
        i = i + 1
        hX(i) = cx + magnify * xCard(a)
        hY(i) = cy - magnify * yCard(a)
    Next
End Sub

   

Print this item

  _OpenFileDIalog$() and MouseButton(1)
Posted by: Fantomas - 02-13-2026, 10:45 AM - Forum: Programs - Replies (12)

When i use _OpenFileDIalog$ to select a file to load, it seems that MouseButton(1) stay to -1 (without press left button) ?!
I need clic to make it change to 0.

How could i make   MouseButton(1) = 0 because left button is not pressed ?

Thanks !

Print this item

  Format Library
Posted by: eoredson - 02-13-2026, 03:55 AM - Forum: One Hit Wonders - Replies (8)

Find attached the file FormatX7.zip which contains FormatX.bas and is a library of format functions.

They are not a Print Using replicants but contain certain FormatX$ functions similar to the ones in QB 7.1

The functions allow for parsing formatted strings and unique to QB64 which has no Format$ functions.

  Year between 1753 and 2078 increased to 0001 and 9999.

NOT backwards compatible with QB 4.5 because format date/time is stored in float Now## precision.

https://qb64phoenix.com/forum/attachment.php?aid=4606



Attached Files
.zip   FORMATX7.ZIP (Size: 21.01 KB / Downloads: 15)
Print this item