Welcome, Guest |
You have to register before you can post on our site.
|
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.
|
|
|
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
|
|
|
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.
|
|
|
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
|
|
|
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...
- Native BOOL _TRUE and _FALSE (maybe using '$:BOOL to make it optional)
- Optional parameters for SUBs and FUNCTIONs
- EVAL("QB CODE")
- Returning arrays from SUBs and FUNCTIONs
- Arrays inside UDTs
- Arrays of UDTs inside UDTs
- Passing FUNCTIONs and SUBs into other FUNCTIONs and SUBs
- '$INCLUDE_ONCE:
- Native JSON ('$JSON)
- Native DICTIONARY ('$DICTIONARY)
- 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.
(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.
(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.
|
|
|
|