Search found 1363 matches

by GPI
Mon Jan 05, 2026 7:16 pm
Forum: Bugs - Linux
Topic: [6.21 ARM] Flipbuffers() miss vsync / unstable framerate
Replies: 0
Views: 91

[6.21 ARM] Flipbuffers() miss vsync / unstable framerate

PureBasic 6.21 - C Backend (Linux - arm64)

InitSprite()

#width=1000
#height=800

OpenWindow(1,0,0,#width+200,#height,"vysnc-test",#PB_Window_SystemMenu)
EditorGadget(1,#width,0,200,#height)

OpenWindowedScreen(WindowID(1),0,0,#width,#height,#False,0,0,#PB_Screen_WaitSynchronization)

Repeat ...
by GPI
Wed Aug 04, 2021 2:52 pm
Forum: Announcement
Topic: PureBasic 6.00 released !
Replies: 626
Views: 291600

Re: PureBasic 6.00 Alpha 3 released !


First of all, this is no "really bad code".
This is how OpenWindow() worked since ... the beginning(?), it returned the OS handle.

It *IS* really bad code, because it is not documentated. You used a undocumented feature and undocumented feature can change *every* version without noticing it ...
by GPI
Wed Jul 28, 2021 5:56 am
Forum: Coding Questions
Topic: (Solved) short program dies on AllocateMemory (5.73 x64)
Replies: 3
Views: 4274

Re: short program dies on AllocateMemory (5.73 x64)

I can't test it here, but the *mem-Buffer is to small, StringByteLength return the length without the zero-end-byte, CopyMemoryString DOES copy the zero-byte. You should add a "SizeOf(Character)".
by GPI
Wed Jul 21, 2021 1:52 pm
Forum: Game Programming
Topic: MATH - Repost
Replies: 6
Views: 7479

Re: MATH - Repost


In which world your FastDist() returns a distance in 3D space?


In many cases you can work with squares without problems.
"distance < 2" is true, then "distance² < 4²" is also true. As long as you only want to compare distances, it is faster than calculating the square root of a number.
by GPI
Tue Jul 20, 2021 3:24 pm
Forum: Coding Questions
Topic: How to extract JSONObjects from a JSON Array?
Replies: 6
Views: 4227

Re: How to extract JSONObjects from a JSON Array?

Procedure DebugJson(injVal,deep=0)
Select JSONType(injVal)
Case #PB_JSON_Null: Debug Space(deep*2)+Hex(injVal)+" null"
Case #PB_JSON_String: Debug Space(deep*2)+Hex(injVal)+" string "+GetJSONString(injVal)
Case #PB_JSON_Number: Debug Space(deep*2)+Hex(injVal)+" number "+StrD(GetJSONDouble ...
by GPI
Sun Jul 18, 2021 8:45 pm
Forum: Coding Questions
Topic: [SOLVED] Array in callback Procedure
Replies: 3
Views: 2870

Re: Array in callback Procedure

The only methode (without reading undocumented pb-internal-data) that I found is a array in a structure:
Structure One
a1.i
b1.i
etc.i
EndStructure

Structure MyArray
Array one.one(0,0,0)
EndStructure

two.MyArray
Dim two\one(1,2,4)

three.MyArray
Dim three\one(5,6,7)

Procedure Check(*p ...
by GPI
Sun Jul 18, 2021 8:29 pm
Forum: Tricks 'n' Tips
Topic: Procedural Generation Labyrinth
Replies: 3
Views: 3672

Re: Procedural Generation Labyrinth

you can change the size of the labyrinth with the #widht and #height constants. My console is 120x30 Chars wide (right-click on the console-titelbar, select properties and change in the layout-tab (I have a german window, so the names may be a little diffrents).
by GPI
Sat Jul 17, 2021 9:14 pm
Forum: Tricks 'n' Tips
Topic: Procedural Generation Labyrinth
Replies: 3
Views: 3672

Procedural Generation Labyrinth

https://i.imgur.com/bE1D70K.png

Based on https://www.youtube.com/watch?v=ZZY9YE7rZJw

This code creates from a seed a labyrinth.

; Based on https://www.youtube.com/watch?v=ZZY9YE7rZJw

DeclareModule RND
EnableExplicit

; get a random number (32bit)
Declare.l get()

; get a random double ...
by GPI
Tue Jul 13, 2021 8:10 pm
Forum: Announcement
Topic: PureBasic 6.00 released !
Replies: 626
Views: 291600

Re: PureBasic 6.00 Alpha 3 released !

Define hwnd
hwnd = OpenWindow(0, 0, 0, 230, 90, "Event handling example...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
Debug "hwnd = " + hwnd + " == WindowID = " + WindowID(0)
This is a really bad code.

https://www.purebasic.com/documentation/window/openwindow.html
Return value ...
by GPI
Tue Jul 13, 2021 12:14 pm
Forum: Announcement
Topic: PureBasic 6.00 released !
Replies: 626
Views: 291600

Re: PureBasic 6.00 Alpha 3 released !


No! According to Microsoft a 32-bit handle works in 32-bit and 64-bit applications:


Your mistake is, that this is only valid for WIN32-API-Handles. BUT we talk about PureBasic-Handles! Handles in Purebasic are more like an ID. And this ID can be 64BIt on a 64-bit System.

OpenWindow for ...
by GPI
Tue Jul 13, 2021 12:07 pm
Forum: Announcement
Topic: PureBasic 6.00 released !
Replies: 626
Views: 291600

Re: PureBasic 6.00 Alpha 3 released !

which is ok, since it is not definied what kind of handles they return, it is only definied, that it return a "number" in Integer-range.

it is also possible, that you will have with the asm-backend strange bugs, because you used the wrong type, for example on large memory-usage it could use memory ...
by GPI
Tue Jul 13, 2021 6:07 am
Forum: Announcement
Topic: PureBasic 6.00 released !
Replies: 626
Views: 291600

Re: PureBasic 6.00 Alpha 3 released !

as far as i know: Handles in PB are *ALWAYS* in Integer. so ".l" is not correct and when it work, it is pure luck.
by GPI
Sat Jul 03, 2021 8:33 pm
Forum: Linux
Topic: [PB 5.73 LTS x64] QT vs GTK2 DrawingBuffer Size Difference
Replies: 3
Views: 6035

Re: [PB 5.73 LTS x64] QT vs GTK2 DrawingBuffer Size Difference

The buffer must contain the complete Image, but for better performace it can be much bigger.

also MemorySize() ist only valid for memorys allocated with AllocateMemory(), not from DrawingBuffer().
With your example you get some value, but it can be complete wrong.
I personaly think, that the ...
by GPI
Sun Jun 20, 2021 8:25 am
Forum: Coding Questions
Topic: Clam Antivirus - wrapping the libclamav.dll
Replies: 11
Views: 5047

Re: Clam Antivirus - wrapping the libclamav.dll

Some notes:
unsigned int, signed int and int are always 32-bit-values, even on a 64-bit exe. So you should always use "l"/"long".
a "long int" is a 64-bit value, use "q" or "quad"

"a const char *path" can you replace in a prototype with "path.p-utf8" (note no star here!) - pb will then convert all ...
by GPI
Sat Jun 19, 2021 5:09 pm
Forum: Feature Requests and Wishlists
Topic: Add 'MacroReturn' command for Purebasic macros
Replies: 5
Views: 4887

Re: Add 'MacroReturn' command for Purebasic macros

what you want is a "inline"- Prefix for Procedures.

With the c-Backend this would be easy possible. For assembler-backend not, but since a "inline" is only a suggestion, it could easy be ignored.

A "macroreturn" would make no sense who macros work...