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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 325
» Latest member: WillieTop
» Forum threads: 1,757
» Forum posts: 17,918

Full Statistics

Latest Threads
лучшие песни медляки слуш...
Forum: Petr
Last Post: WillieTop
Yesterday, 02:21 AM
» Replies: 0
» Views: 18
пинк слушать онлайн беспл...
Forum: SMcNeill
Last Post: WillieTop
Yesterday, 02:20 AM
» Replies: 0
» Views: 16
скачать музыку российскую...
Forum: madscijr
Last Post: WillieTop
Yesterday, 02:18 AM
» Replies: 0
» Views: 15
нежная музыка mp3 скачать
Forum: Keybone
Last Post: WillieTop
Yesterday, 02:17 AM
» Replies: 0
» Views: 14
лучшая песня слушать онла...
Forum: bplus
Last Post: WillieTop
Yesterday, 02:16 AM
» Replies: 0
» Views: 16
пикник слушать онлайн луч...
Forum: Spriggsy
Last Post: WillieTop
Yesterday, 02:15 AM
» Replies: 0
» Views: 16
какая сейчас популярная м...
Forum: RhoSigma
Last Post: WillieTop
Yesterday, 02:14 AM
» Replies: 0
» Views: 15
хит лета 2019 музыка на т...
Forum: Christmas Code
Last Post: WillieTop
Yesterday, 02:12 AM
» Replies: 0
» Views: 19
бесплатная музыка mp3 рег...
Forum: Works in Progress
Last Post: WillieTop
Yesterday, 02:11 AM
» Replies: 0
» Views: 15
лучшие хиты музыка 2018 2...
Forum: Utilities
Last Post: WillieTop
Yesterday, 02:10 AM
» Replies: 0
» Views: 16

 
  Mod'ing a classic- partial circle fill
Posted by: OldMoses - 01-17-2023, 12:25 AM - Forum: Utilities - Replies (6)

Something that I've needed for one of my projects for a long time. A modification of the circle fill algorithm that restricts the draw to the limits of a bounding box. I'm not sure why it took me so long to get around to this, but here it is, in case someone can make use of it or are inspired to wow us with a better solution.

Left button click to place the center of the box, mousewheel to change the box size.


Code: (Select All)
'OldMoses' mod of Steve's circle fill
'drawing only those portions that fit the bounding box

'e% = 128
sz% = 50
ls% = 300
rs% = 400
t% = 100
b% = 200
SCREEN _NEWIMAGE(1024, 512, 32)
DO
    WHILE _MOUSEINPUT
        osz% = wsz%
        wsz% = SGN(_MOUSEWHEEL) * 3
        IF osz% <> sz% THEN
            ls% = ls% - wsz%: rs% = rs% + wsz%
            t% = t% - wsz%: b% = b% + wsz%
            sz% = sz% + wsz%
        END IF
    WEND
    IF _MOUSEBUTTON(1) THEN
        ls% = _MOUSEX - sz%: rs% = _MOUSEX + sz%
        t% = _MOUSEY - sz%: b% = _MOUSEY + sz%
    END IF

    CLS
    'LINE (512 - e%, 256 - e%)-(512 + e%, 256 + e%)
    'LINE (512 + e%, 256 - e%)-(512 - e%, 256 + e%)
    LINE (ls%, t%)-(rs%, b%), , B '                             Bounding box

    'CIRCLE (512, 256), 128, &H7FFF0000
    FCirc 512, 256, 128, &H7FFF0000 '                           Steve's unmodified circle fill
    FCircPart 512, 256, 128, &H7F00FF00, ls%, rs%, t%, b% '     modified partial circle fill

    _LIMIT 30
    _DISPLAY
LOOP UNTIL _KEYDOWN(27)
END



SUB FCircPart (CX AS LONG, CY AS LONG, RR AS LONG, C AS _UNSIGNED LONG, lt AS LONG, rt AS LONG, t AS LONG, b AS LONG) 'modified circle fill
    IF rt < CX - RR OR lt > CX + RR OR t > CY + RR OR b < CY - RR THEN EXIT SUB 'leave if box not intersecting circle
    DIM AS LONG R, RError, X, Y
    R = ABS(RR) '                                               radius value along positive x
    RError = -R '                                               opposite side of circle? negative x
    X = R '                                                     point along positive x position
    Y = 0 '                                                     starting at the equator
    IF R = 0 THEN PSET (CX, CY), C: EXIT SUB '                  zero radius is point, not circle
    IF CY >= t AND CY <= b THEN LINE (MinOf&(CX - X, lt), CY)-(MaxOf&(CX + X, rt), CY), C, BF 'draw equatorial line if applicable
    WHILE X > Y
        RError = RError + Y * 2 + 1 '
        IF RError >= 0 THEN
            IF X <> Y + 1 THEN
                IF CY - X >= t AND CY - X <= b AND CX - Y <= rt AND CX + Y >= lt THEN
                    LINE (MinOf&(CX - Y, lt), CY - X)-(MaxOf&(CX + Y, rt), CY - X), C, BF ' draw lines for south polar latitudes
                END IF
                IF CY + X <= b AND CY + X >= t AND CX - Y <= rt AND CX + Y >= lt THEN
                    LINE (MinOf&(CX - Y, lt), CY + X)-(MaxOf&(CX + Y, rt), CY + X), C, BF ' draw lines for north polar latitudes
                END IF
            END IF
            X = X - 1
            RError = RError - X * 2
        END IF
        Y = Y + 1
        IF CY - Y >= t AND CY - Y <= b AND CX - X <= rt AND CX + X >= lt THEN
            LINE (MinOf&(CX - X, lt), CY - Y)-(MaxOf&(CX + X, rt), CY - Y), C, BF '         draw lines north equatorial latitudes
        END IF
        IF CY + Y <= b AND CY + Y >= t AND CX - X <= rt AND CX + X >= lt THEN
            LINE (MinOf&(CX - X, lt), CY + Y)-(MaxOf&(CX + X, rt), CY + Y), C, BF '         draw lines south equatorial latitudes
        END IF
    WEND
END SUB 'FCircPart


SUB FCirc (CX AS LONG, CY AS LONG, RR AS LONG, C AS _UNSIGNED LONG) 'Steve's circle fill unmodified
    DIM AS LONG R, RError, X, Y
    R = ABS(RR) '                                               radius value along positive x
    RError = -R '                                               opposite side of circle? negative x
    X = R '                                                     point along positive x position
    Y = 0 '                                                     starting at the equator
    IF R = 0 THEN PSET (CX, CY), C: EXIT SUB '                  zero radius is point, not circle
    LINE (CX - X, CY)-(CX + X, CY), C, BF '                     draw equatorial line
    WHILE X > Y
        RError = RError + Y * 2 + 1 '
        IF RError >= 0 THEN
            IF X <> Y + 1 THEN
                LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF ' draw lines for south polar latitudes
                LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF ' draw lines for north polar latitudes
            END IF
            X = X - 1
            RError = RError - X * 2
        END IF
        Y = Y + 1
        LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF '         draw lines north equatorial latitudes
        LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF '         draw lines south equatorial latitudes
    WEND
END SUB 'FCirc


FUNCTION MaxOf& (value AS LONG, max AS LONG)
    MaxOf& = -value * (value <= max) - max * (value > max)
END FUNCTION 'MaxOf%

FUNCTION MinOf& (value AS INTEGER, minimum AS INTEGER)
    MinOf& = -value * (value >= minimum) - minimum * (value < minimum)
END FUNCTION 'MinOf%

Print this item

  Hi CPU Usage even at rest
Posted by: daivdW2 - 01-16-2023, 12:05 PM - Forum: General Discussion - Replies (11)

Hello. 

First, I would like to say how much I am enjoying using QB64PE - This is my first post. 

I have installed QB64PE it on a Linux VM but I have noticed that it takes my CPU up beyond 90% even when only the IDE is open and no code is running (the fan screaming lets me know!)

I have included two graphs below. The first with the larger area is QB64PE running a small program and then sitting in the IDE only. 

The second with the smaller area, is the same small program in QB64. 

Is there a known issue I should be aware of? 



[Image: msedge-gy-Pqk3lokl.png]
[Image: bmsedge-gy-Pqk3lokl.png]

Print this item

  Rotating Sphere in Visual Basic
Posted by: eoredson - 01-16-2023, 01:31 AM - Forum: QBJS, BAM, and Other BASICs - Replies (1)

Speaking of other basics and 3-d arrays for rotating sphere:

Code: (Select All)
Sphere is v9.0a of the rotating stereoscopic sphere integral.

Program Sphere displays a rotating real-time integral of the sphere which
can be modified over x/y/z axis, +/- radius, and switch to mono mode. This
red/blue output can be visualized with 'stage' glasses to simulate 3-D
views.

Stage glasses contain a red filter on the left lens and a blue filter
on the right lens.

Sphere v7.0a upgrades include movable/restorable buttons in freeze mode.

Sphere v8.0a upgrades add PictureBox & TextBox movable objects, and
corrects a small divide by zero error. Also allows any of 21 buttons
to be Drag 'n' Dropped onto any other of the 21 buttons, including
TextBox and PictureBox dropping..

Sphere v9.0a updates the install procedure to include all missing .ocx files.

Complete source and executable for VB 5.0 are included. Compiled with
VB 5.0 Enterprise w/ Service Pack 3.

This shareware product is public domain and can be distributed freely.

-end-

Here are 2 of them.

Sphere5.zip - original source
Sphere9.zip - latest source.

Erik.


[Image: sphere.png]



these should work in VB5 and VB6..

.zip   sphere5.zip (Size: 25.11 KB / Downloads: 47)
.zip   sphere9.zip (Size: 2.26 MB / Downloads: 44)

Print this item

  Select All
Posted by: Dimster - 01-15-2023, 04:58 PM - Forum: General Discussion - Replies (2)

I don't seem to be able to click, or right click, on the "Code:Select All" option any more whether I'm logged on or not. It's been a while since I tried to Select All so now I'm wondering if I ever did have the option to just click on Select All and all the code was highlighted. Have we lost that ability? It's not a big deal, I am able to just highlight it all by dragging my mouse to the end of code but as I age I continue to fear I'm fantasying a digital world that never existed.

Print this item

  Hardware Images
Posted by: SMcNeill - 01-14-2023, 02:43 PM - Forum: Learning Resources and Archives - Replies (11)

Someone on Discord sent me a couple of messages asking what the big deal was with hardware images, and why anyone would ever bother with them.   I hope the little demo below here will be sufficient enough to showcase why folks might want to make use of hardware images in their programs.

Code: (Select All)
DIM count AS _INTEGER64
displayScreen = _NEWIMAGE(1024, 720, 32)
workScreen = _NEWIMAGE(512, 360, 32)

SCREEN displayScreen
_DEST workScreen
FOR i = 1 TO 100 'draws something on the drawscreen
    LINE (RND * _WIDTH, RND * _HEIGHT)-(RND * _WIDTH, RND * _HEIGHT), _RGB32(RND * 256, RND * 256, RND * 256), BF
NEXT
hardwareScreen = _COPYIMAGE(workScreen, 33)

_DEST displayScreen

PRINT "For this demo, we're going to be scaling and placing a premade image onto the screen."
PRINT "For ease of output, our FPS count is going to be placed up in the TITLE area."
PRINT
PRINT "First, we'll do a FPS cound of simple software images."
PRINT "Let it run a few seconds, and then press <ANY KEY> when you'd like to move on."
PRINT
PRINT "After that, we'll use hardware images AND software images, and see how things compare."
PRINT "As before, watch the TITLE area for updates, and press <ANY KEY> when ready to move on."
PRINT
PRINT "And finally, we'll JUST use hardware images for our display."
PRINT "Once again, our FPS second count will be in the TITLE area, and you can press <ANY KEY> to"
PRINT "move to our final resulsts screen for ease of comparison."
PRINT
PRINT
PRINT "Press <ANY KEY> to begin."
SLEEP

_DELAY .5
_KEYCLEAR 'time to release any key


time# = TIMER + 1
DO
    CLS , 0
    scount = scount + 1
    IF TIMER > time# THEN
        _TITLE "Software FPS:" + STR$(scount)
        IF scount > smax THEN smax = scount
        scount = 0
        time# = TIMER + 1
    END IF
    _PUTIMAGE , workScreen
    _DISPLAY
LOOP UNTIL _KEYHIT

_DELAY .5
_KEYCLEAR 'time to release any key

time# = TIMER + 1
DO
    CLS , 0
    mcount = mcount + 1
    IF TIMER > time# THEN
        _TITLE "Mixed FPS:" + STR$(mcount)
        IF mcount > mmax THEN mmax = mcount
        mcount = 0

        time# = TIMER + 1
    END IF
    _PUTIMAGE , hardwareScreen
    _DISPLAY
LOOP UNTIL _KEYHIT

_DELAY .5
_KEYCLEAR 'time to release any key

time# = TIMER + 1
_DISPLAYORDER _HARDWARE
CLS , 0
DO
    hcount = hcount + 1
    IF TIMER > time# THEN
        _TITLE "Hardware FPS:" + STR$(hcount)
        IF hcount > hmax THEN hmax = hcount
        hcount = 0
        time# = TIMER + 1
    END IF
    _PUTIMAGE , hardwareScreen
    _DISPLAY
LOOP UNTIL _KEYHIT

_DISPLAYORDER _SOFTWARE , _HARDWARE
CLS , 0
_AUTODISPLAY

PRINT USING "###,###,### FPS with Software Images"; smax
PRINT USING "###,###,### FPS with Software and Hardware Images"; mmax
PRINT USING "###,###,### FPS with Hardware Images only"; hmax
PRINT
PRINT
PRINT "I would think the figures here alone, would showcase why one might want to use hardware images over other types, when possible."






[Image: image.png]

Print this item

  Trying out some old programs from QB45.org
Posted by: CharlieJV - 01-14-2023, 04:09 AM - Forum: QBJS, BAM, and Other BASICs - Replies (13)

These are programs from the (previously) "QB45.org" site that I find particularly interesting.  In the BAM version of the source code, you'll find the details of the original source code that you can grab for QB64pe. 

From "Graphics Demos" file category:


(More to come from the qb45.org site.)

Print this item

  _OPENHOST to port 443 fails
Posted by: jleger2023 - 01-14-2023, 03:08 AM - Forum: Help Me! - Replies (9)

Hey all,

This is my first post here. I'm tinkering with QB64 to create a simple server. Listening on port 80 or port 8080 works just fine, but when I try to listen on port 443 it always returns 0 (fail). I've added port access to the Windows firewall and even tried disabling the firewall completely in case I'd done something wrong, but it still fails.

Here's my code. Any ideas? Thanks in advance.

Code: (Select All)
Dim socketHost As Integer
Dim socketClients(1000) As Integer
Dim clientIndex As Integer
Dim socketClient As Integer
Dim socketData As String

socketHost = _OpenHost("TCP/IP:443")

If socketHost Then
    Print "LISTENING @ " + _ConnectionAddress(socketHost)
    Do
        socketClient = _OpenConnection(socketHost)
        If socketClient Then
            socketClients(clientIndex) = socketClient
            clientIndex = clientIndex + 1
        End If

        For i = 0 To clientIndex - 1
            Get #socketClients(clientIndex), , socketData
            Print socketData
        Next
    Loop

    Close #socketHost
Else
    Print "Failed to open socket to port 443."
End If

Print this item

  _WIDTH(_LOADIMAGE()) Ok?
Posted by: TerryRitchie - 01-13-2023, 01:45 PM - Forum: Help Me! - Replies (9)

I recently saw some code that did this:

ImageWidth = _WIDTH(_LOADIMAGE("Image.png", 32))

Will this leave the image's contents in RAM with no way of freeing it?

-or-

Will the image be discarded since the handle was not assigned to a variable?

It's a neat trick and one that I could happen to use on a current project but not if the image is orphaned in RAM.

Print this item

  What folder IDE defaults to, for opening files
Posted by: bert22306 - 01-13-2023, 04:14 AM - Forum: General Discussion - Replies (2)

Okay, I see that maybe this belonged in the general discussion area:

Is there any way to configure the IDE of v3.5.0 to open .bas files by default in the last folder you used? That, and using File Explorer, were my favorite improvements in 3.4.1.

Was there a deliberate decision to always open inside the qb64pe folder instead? I never store my programs there. Does anyone use that folder for their .bas files? Seems messy.

If there's an easy way to fix this, without having to wait for another complete version update, that would be great.

Print this item

  Upgrading from version to version
Posted by: bobalooie - 01-13-2023, 02:34 AM - Forum: General Discussion - Replies (3)

General question: When upgrading from one version to another (say 3.4 to 3.5), which files in the upgrade package are really essential to perform the upgrade? For instance, I see in the 3.5 package that all of the c folder has the same rev date as the rest of the package, but I would be surprised if the entire toolchain is upgraded.

Print this item