Welcome, Guest |
You have to register before you can post on our site.
|
|
|
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 (13)
|
|
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.
|
|
|
Simple 3D morphing with _MAPTRIANGLE |
Posted by: RokCoder - 01-10-2023, 11:41 PM - Forum: Programs
- Replies (6)
|
|
I went on a complete tangent from what I was intending to do this evening when I stumbled upon _MAPTRIANGLE!
First this project creates the vertices of a cube - but it does this based on a hard-coded TESSELATION constant. If this is set to one then each face of the cube has four vertices, if it's set to two then each face has nine vertices, 16 vertices for a value of 4, etc.
The reason for allowing the tessellation is that the project continually morphs between a cube and a sphere (while rotating on three axes). The higher the tessellation value, the better the quality of the sphere but also the greater the number of vertices, calculations, triangles to render, etc. I wanted the code to be clear and well commented so it isn't optimised at all (which is why I've set the tessellation value quite low).
The ZIP file containing the project and its assets is attached. As always, you can also find the code over at my GitHub.
morph.zip (Size: 419.28 KB / Downloads: 58)
On a side note, does anyone know if _CLOCKWISE and _ANTICLOCKWISE actually do anything at the moment in _MAPTRIANGLE? I tried using it to do the back-face culling but it didn't seem to have any effect so I ended up using cross-products for the culling.
On a second side note, is there any command for altering the brightness while rendering? I had a brief go with _SETALPHA for each triangle being rendered but (a) it didn't seem to affect _MAPTRIANGLE and (b) the performance impact was horrendous.
|
|
|
|