Welcome, Guest |
You have to register before you can post on our site.
|
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%
|
|
|
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.
|
|
|
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."
|
|
|
_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
|
|
|
_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.
|
|
|
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.
|
|
|
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.
|
|
|
|