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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 308
» Latest member: Donaldvem
» Forum threads: 1,741
» Forum posts: 17,901

Full Statistics

Latest Threads
The QB64 IDE shell
Forum: Utilities
Last Post: JasonPag
09-16-2024, 05:37 PM
» Replies: 9
» Views: 731
Importance regarding Ches...
Forum: Utilities
Last Post: JasonPag
09-01-2024, 06:34 PM
» Replies: 0
» Views: 25
Chess and Analysis and En...
Forum: Utilities
Last Post: JasonPag
08-28-2024, 02:37 PM
» Replies: 0
» Views: 24
DAY 009:_PutImage
Forum: Keyword of the Day!
Last Post: grymmjack
09-02-2023, 02:57 PM
» Replies: 54
» Views: 1,851
Fall Banner Contest?
Forum: Site Suggestions
Last Post: grymmjack
08-31-2023, 11:50 PM
» Replies: 36
» Views: 1,141
ColorPicker - Function th...
Forum: Dav
Last Post: Dav
08-31-2023, 11:04 PM
» Replies: 3
» Views: 304
Goals(1) = New Tile()
Forum: Works in Progress
Last Post: RhoSigma
08-31-2023, 09:45 PM
» Replies: 3
» Views: 112
micro(A)v11
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 09:14 PM
» Replies: 90
» Views: 3,306
Updating The Single Most ...
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 09:13 PM
» Replies: 7
» Views: 224
QBJS Image Question
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 05:49 PM
» Replies: 5
» Views: 134

 
  Compiler dead space is it all the same ?
Posted by: doppler - 08-20-2023, 09:10 AM - Forum: General Discussion - Replies (9)

And what the hell is compiler dead space, you may ask.

People who write compilers have a habit of being lazy, very lazy.  The coding part (your executable) will be the same from computer to computer.  This is true as long as the compilers are the same version.  So code from one computer coding will have the same SHA hash value as the next.  What will change is data and string areas.  The same areas which contain uninitialized memory for storage.  A dumb compiler will just assign the space.  Which shows up as a random segment of the compiling computers memory.  Looking at the EXE code in RAW mode may show some interesting information.  A smart compiler will zero out all data and string areas before sending it to the linker/exe module.

So is QB64pe using a smart or dumb compiler/linker ?  The reason I am asking is "If I send someone source code and a SHA of the resulting EXE."  I can determine if compilers are the same version on my computer and his/her computer.  Thus resolving compiler issues before they become a problem.  AKA: They said they were up to date, only to find they are 3 versions behind.

Thanks.
Nobody here may have an answer.  This a very inside question about the GCC compiler QB64pe is using.

Print this item

  fhex ... a Filled Hex
Posted by: James D Jarvis - 08-19-2023, 06:52 PM - Forum: Utilities - Replies (2)

a little routine and associated demo for drawing a filled hex.

Code: (Select All)
'Fhex
'by James D. Jarvis August 19,2023
'draw a filled hex
'demo code
Screen _NewImage(500, 500, 32)
rr = 200
For d = 1 To 10
    fcirc 250, 250, rr, _RGB32(200, 200, 0)
    fhex 250, 250, rr, _RGB32(200, 100, 100)
    rr = rr * .86
Next d
For a = 60 To 360 Step 60
    ang_line 250, 250, 200, a, _RGB32(250, 0, 0)
Next a

hx = 60: hy = 60: hl = 12
fhex hx, hy, hl, _RGB32(100, 100, 100)
For ha = 30 To 390 Step 60
    hx = 60 + (hl * 1.9) * Cos(0.01745329 * ha)
    hy = 60 + (hl * 1.9) * Sin(0.01745329 * ha)
    fhex hx, hy, hl, _RGB32(ha / 2, ha / 2, ha / 20)
Next ha

Sub fhex (cx As Long, cy As Long, r, klr As _Unsigned Long)
    'draw a hex to radius r filled with color klr centeted on cx,cy
    rcheck = ((r * .867) * (r * .867))
    For dY = -r To r
        If dY * dY < rcheck Then
            dx = r - Abs(dY / _Pi * 1.81)
            Line (cx - dx, dY + cy)-(cx + dx, dY + cy), klr, BF
        End If
    Next dY
End Sub


'ang_line and fcirc included for demo not needed for fhex itself
Sub ang_line (sx, sy, lnth, ang, klr As _Unsigned Long)
    'draw a line lnth units long from sx,sy at anlge ang measures in degrees, 0 deg is out along X axis
    nx = sx + lnth * Cos(0.01745329 * ang)
    ny = sy + lnth * Sin(0.01745329 * ang)
    Line (sx, sy)-(nx, ny), klr

End Sub
Sub fcirc (CX As Long, CY As Long, R, klr As _Unsigned Long)
    'draw a filled circle with the quickest filled circle routine in qb64, not my development
    Dim subRadius As Long, RadiusError As Long
    Dim X As Long, Y As Long
    subRadius = Abs(R)
    RadiusError = -subRadius
    X = subRadius
    Y = 0
    If subRadius = 0 Then PSet (CX, CY): Exit Sub
    Line (CX - X, CY)-(CX + X, CY), klr, BF
    While X > Y
        RadiusError = RadiusError + Y * 2 + 1
        If RadiusError >= 0 Then
            If X <> Y + 1 Then
                Line (CX - Y, CY - X)-(CX + Y, CY - X), klr, BF
                Line (CX - Y, CY + X)-(CX + Y, CY + X), klr, BF
            End If
            X = X - 1
            RadiusError = RadiusError - X * 2
        End If
        Y = Y + 1
        Line (CX - X, CY - Y)-(CX + X, CY - Y), klr, BF
        Line (CX - X, CY + Y)-(CX + X, CY + Y), klr, BF
    Wend
End Sub

Print this item

  Microsoft BASIC PDS 7.1 User Interface Toolbox
Posted by: a740g - 08-19-2023, 04:49 AM - Forum: Programs - Replies (6)

This was supposed to go in the Museum a long time ago. However, I never got to re-implementing the assembler routines that this uses... until now.
I've included the assembly sources as comments in General.bas. Below those comments you can find the QB64 function ports.

From MS PDS 7.1 Getting Started docs:

Quote:User Interface Toolbox

With the new user interface code samples, you can design your own user interface using
BASIC procedures. The code samples in this toolbox give you complete control of character-
based window interfaces. For example, you could write a BASIC program with multiple
windows, menu bars, dialog boxes, and mouse interaction. For more information about the User
Interface toolbox, see Part 3 of the BASIC Language Reference.
Please note that this is by no means a perfect port. There are a few differences and quirks.

Happy tinkering!

[Image: Screenshot-2023-08-19-010014.png]

[Image: Screenshot-2023-08-19-081928.png]

[Image: Screenshot-2023-08-19-082014.png]

[Image: Screenshot-2023-08-19-082028.png]



Attached Files
.zip   PDSUITB64.zip (Size: 45.29 KB / Downloads: 36)
Print this item

  API Questions
Posted by: TerryRitchie - 08-18-2023, 07:35 PM - Forum: Help Me! - Replies (24)

Since I've started diving into API calls I figured a dedicated thread for API related questions would be better.

Here is my first question.

In the Wiki here: https://qb64phoenix.com/qb64wiki/index.p...ndow_Focus

It's shown how to determine the foreground window (the one in focus).

The Microsoft docs for GetForegroundWindow are located here: https://learn.microsoft.com/en-us/window...oundwindow

I noticed in the Wiki example that GetForegroundWindow is declared as an _OFFSET (%&). How was this determined? Looking at the Microsoft docs there is no indication of the type of variable returned. With other window handle (hWnd) related functions I've noticed a variable type of LONG is used. Why was _OFFSET needed here instead of LONG?

This has me confused. Any clarification would be greatly appreciated.

Print this item

  Is _WINDOWHANDLE working properly?
Posted by: TerryRitchie - 08-17-2023, 08:41 PM - Forum: Help Me! - Replies (15)

First, I'm a complete noob to API calls so this just may be my ignorance on the subject.

@SpriggsySpriggs suggested I use GetClientRect to get the client area coordinates of a Window. So I set up some code below to investigate.

However, no matter what size the screen is set to the return values of the RECT are always 0,0 - 640,400.

This makes me think that perhaps _WINDOWHANDLE is pointing to an underlying console window instead of the currently visible window?

Am I correct in my thinking, or am I using _WINDOWHANDLE incorrectly?

Code: (Select All)
TYPE RECTAPI
    left AS LONG
    top AS LONG
    right AS LONG
    bottom AS LONG
END TYPE

DIM apirect AS RECTAPI

DECLARE DYNAMIC LIBRARY "user32"
    'https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getclientrect
    FUNCTION GetClientRect% (BYVAL hWnd AS LONG, lpRect AS RECTAPI)
END DECLARE

SCREEN _NEWIMAGE(800, 600, 32) ' results the same no matter what size screen is used??

tmp = GetClientRect(_WINDOWHANDLE, apirect)

PRINT apirect.left
PRINT apirect.top
PRINT apirect.right
PRINT apirect.bottom

Print this item

  QBJS Particle Fountain
Posted by: bplus - 08-17-2023, 09:19 AM - Forum: QBJS, BAM, and Other BASICs - Replies (1)

I am tweaking dbox pset version with less bubble release each frame for consistent fountain pattern (same tweak as in Proggies) PLUS a wider viewing frame that spreads Bell Curve a little better:

https://qbjs.org/index.html?code=J09wdGl...A1FTdWIKCg==


   

Print this item

  Number Touch - Number block moving puzzle game
Posted by: Dav - 08-17-2023, 03:21 AM - Forum: Dav - Replies (1)

NUMBER TOUCH is my version of a popular online puzzle called 'NumberHood'.  The goal is to move the blocks, side by side, until they all turn green.  Each block has a number. That number means how many blocks that block must touch to turn green.  Blocks with a 1 have to touch 1 other block to turn green.  Blocks with a 2 have to touch 2 other blocks, etc.  If they touch too many other blocks, then the block will turn red.  When place just right, all blocks will turn green and the level is solved.  The screenshot should help you understand the game better.  There are 15 levels, move to them with the arrow keys if you want.

This is updated from the one posted at the old forum.  Now auto-sizes to fit your desktop screensize, , has game sounds, and I also fixed a couple bugs.

- Dav


.zip   numbertouch.zip (Size: 122.87 KB / Downloads: 18)

   

Print this item

Rainbow antonis.de is a gold mine!
Posted by: grymmjack - 08-17-2023, 12:58 AM - Forum: General Discussion - Replies (5)

Anyway. Just wanted to share. This site was found by reading _Antoni.txt included by the source of the QBINVADE.BAS that was posted recently here: https://staging.qb64phoenix.com/showthread.php?tid=1888

http://www.antonis.de/ has loads of great stuff in it.

This site is a gold mine. If you don't speak German, use Google Translate:
https://www-antonis-de.translate.goog/?_...r_hl=en-US

Great resources:
- Books - and some include source code - This one is great http://ethanwiner.com/BTU_BOOK.PDF

- Monster FAQ v2 - with loads of example programs
417 programs. https://www-antonis-de.translate.goog/fa...r_sch=http

- QB Cook Book - great recipes
https://www-antonis-de.translate.goog/qb...=http#soun

Print this item

Star What are good things now to add to QB64?
Posted by: mnrvovrfc - 08-16-2023, 11:39 PM - Forum: General Discussion - Replies (5)

(08-16-2023, 09:50 PM)grymmjack Wrote: As long as we're wishing...

@SMcNeill @a740g @offbyone I asked this in private already, but would like to share this here.

Are there plans to evolve the language further with things like...

  1. Native BOOL  _TRUE and _FALSE (maybe using '$:BOOL to make it optional)
  2. Optional parameters for SUBs and FUNCTIONs
  3. EVAL("QB CODE")
  4. Returning arrays from SUBs and FUNCTIONs
  5. Arrays inside UDTs
  6. Arrays of UDTs inside UDTs
  7. Passing FUNCTIONs and SUBs into other FUNCTIONs and SUBs
  8. '$INCLUDE_ONCE:
  9. Native JSON ('$JSON)
  10. Native DICTIONARY ('$DICTIONARY)
  11. FUNCTIONs and SUBs inside other FUNCTIONs and SUBs

These things are so nice in other languages, I'm finding I'm really missing them.
The issue isn't that QB64PE isn't like every other language - it can be it's own thing, the issue is I'm building bad habits.

GOSUB and GOTO lol - Nothing wrong with them they work fine, but the reason I used those recently is because it's so cumbersome to pass variables around elegantly. The language isn't DRY (Don't Repeat Yourself) at all.

So instead of shimming everything into funcs and subs where i am now using gosub and goto, i just move on with life. 
Meanwhile my cognitive load is higher than it should be in QB64 vs. other languages.

Anyway

Just some thoughts

I've decided to start a new thread so the one by Terry isn't being derailed too much. Not a popularity contest for me LOL.

(1) will require "real" boolean variables and values like Lua and Pascal. In other words, cannot choose any non-zero value as true anymore. Few BASIC programmers would enjoy that, only those like me that had some exposure to languages having boolean types.

(2) This is a high request from me. Smile

(3) Wasn't DSMan or someone else in QB64 team trying to come up with a QB64 interpreter? Because that's what it would involve. If it's only a parser for arithmetic and first-year sequential math stuff then Steve already did that.

(4) This is the same problem as doing it with UDT's -- often too large if it has to be copied. :/

(5) Static arrays inside UDT's is more like it. Otherwise use _MEM. Otherwise figure out how to do an "union" like in C.

(6) No comment.

(7) This could be confusing and difficult to debug; we would need an industrial-strength debugger like that of Purebasic. It's easy to get fancy with function pointers even with simple programs so that other constructs like SELECT CASE... END SELECT are neglected.

(8) Well you already proposed it grymmjack and I support you. Smile

(9) I have to learn that stuff then.

(10) Associative arrays would be a big boost to this programming language despite the performance overhead and the bloat to executables.

(11) Nested subprograms could be a mixed bag like #7. Some people then are going to want function pointers that could point to "local" functions. I'd rather do without it.

How about "AS (type)" at the end of the parameter list, instead of sigil right after FUNCTION name? How about "RESULT =" on LHS instead of having to type in the long-ass FUNCTION name? This last point could over some people who write sloppy programs assigning the function result several times instead of cleanly doing it once, and relying far too much on EXIT FUNCTION.

Don't get me started about GOSUB and RETURN made worthless in Freebasic, for me that's one of the biggest scandals they've ever made. Sorry but in BASIC I want my RETURN back for GOSUB.

Print this item

  Color My Heart - A 'Flush' type color filling puzzle.
Posted by: Dav - 08-16-2023, 11:38 PM - Forum: Dav - No Replies

COLOR MY HEART is kind of a clone of a online puzzle called 'Flush'.  You color the heart squares with it's matching color.  Red heart squares must be filled with red color, Blue hearts must be filled with blue color, etc.  The empty squares must remain empty (white).  

First select the color to use at the top, then click on the arrows to fill the row/column with the color.  It will fill until it hits an X blocked square.  Select the White color to clear one square at a time.  The CLS is a level start over button.  

It's not a hard puzzle, but can be a nice diversion for some.  The screenshot below should give you an idea of what a solved board looks like.  There are 15 levels in this little game. You can move to other levels with the arrow keys.  More info in the source.  This is an updated version to the one posted in the old forum.  Board now auto-sizes with users desktop, has new graphics and also now has sounds.

- Dav


.zip   colormyheart.zip (Size: 266.09 KB / Downloads: 17)

   

Print this item