Search found 1796 matches

by STARGÅTE
Thu Apr 18, 2024 9:27 pm
Forum: Bugs - Windows
Topic: [Done] Static array index-less reference
Replies: 5
Views: 323

Re: [Done] Static array index-less reference

mk-soft wrote: Thu Apr 18, 2024 8:43 pm Oops,
some codes will no longer work.
So please remove this adjustment.
Same here. I often used the \Element[0] -> \Element shortcut when accessing the first element or receive the address of the array with @\Element, even with known sized static arrays.
by STARGÅTE
Thu Apr 18, 2024 6:15 am
Forum: Coding Questions
Topic: Thread Parameters?
Replies: 8
Views: 368

Re: Thread Parameters?

At this point I would like to give an important note for both proposed solutions. In both cases the information is passed just as a reference to the thread, and not as a variable or copy. This means, the myParams.Parameters (first example) or text$ (second example) have to keep as they are as long a...
by STARGÅTE
Sun Apr 07, 2024 6:53 pm
Forum: Coding Questions
Topic: How to create constants automatically?
Replies: 12
Views: 472

Re: How to create constants automatically?

A constant is just a macro with a hashtag. Once defined, it is replace everywhere during the compilation and is not present anymore in the final executable. I think at this point the discussion is closed. When you want to define a constant from another file (during compilation), you can use IncludeF...
by STARGÅTE
Sun Apr 07, 2024 7:06 am
Forum: Coding Questions
Topic: What variable type is "?" for CatchImage?
Replies: 7
Views: 336

Re: What variable type is "?" for CatchImage?

The second argument in CatchImage() is just a memory address. The ? operator is used to receive the memory address from a label: *Address = ? Label CatchImageEnhanced(#GLOBAL_IMAGE_POPUP_EDIT,?popup_edit,"Can't load image.") Procedure CatchImageEnhanced(MARCOAGPINTO_gadget, *Buffer, MARCOA...
by STARGÅTE
Fri Apr 05, 2024 3:49 pm
Forum: Bugs - Windows
Topic: [Done] Sound channel not working properly
Replies: 10
Views: 360

Re: Sound channel not working properly

The channel is not linked to the sound, it's allocated dynamically (you can define a max number of channels in InitSound()) Ahh, that's a new feature, never saw this. It is also not visible in the online documentation: InitSound() Does this mean, if I use InitSound(16), I have only 16 channels in t...
by STARGÅTE
Fri Apr 05, 2024 2:04 pm
Forum: Bugs - Windows
Topic: [Done] Sound channel not working properly
Replies: 10
Views: 360

Re: Sound channel not working properly

infratec wrote: Fri Apr 05, 2024 1:58 pm In my opinion nothing should be heard, because all sounds are paused correct.
Yes, that's also my opinion.

What I was meant was, the returned channel number do not have to be unique, because it is connected to the sound number as well, or am I wrong?
by STARGÅTE
Fri Apr 05, 2024 1:45 pm
Forum: Bugs - Windows
Topic: [Done] Sound channel not working properly
Replies: 10
Views: 360

Re: Sound channel not working properly

The number of the channel is not a global parameter. Each sound number has his own set of channels in which the sound is played. Therefore, Pure Basic functions like PauseSound need the sound number as well as the channel (and not only the channel). If you play #SND_EARTH_CITY, #SND_CONSTRUCTION_LOW...
by STARGÅTE
Fri Apr 05, 2024 11:21 am
Forum: Bugs - Windows
Topic: [Done] LoadImage crashes on faulty BMP-image
Replies: 10
Views: 506

Re: LoadImage crashes on faulty BMP-image

But that mean the compiler should check for 1- Bad format 2- Bad image header magic number 3- No image but image extension(Bad guy idea) And maybe more Not the compiler, but the function LoadImage. Yes of course, that's the task of the function not of the user. Otherwise I have to write my own load...
by STARGÅTE
Fri Apr 05, 2024 5:50 am
Forum: Bugs - Windows
Topic: [Done] LoadImage crashes on faulty BMP-image
Replies: 10
Views: 506

Re: LoadImage crashes on faulty BMP-image

RASHAD wrote: Fri Apr 05, 2024 5:21 am So it's the coder part to avoid the crash when using PB :wink:
No. A language function should never crash, because of incompatible input data. (LoadImage, LoadSound, LoadSprite, etc.)
A language function should return 0 is such cases, but not crash.

It is some kind of security risk.
by STARGÅTE
Wed Apr 03, 2024 6:10 pm
Forum: Bugs - Windows
Topic: [Done] PB 6.10 x86 ASM-backend - IMA at DeleteMapElement() with key
Replies: 4
Views: 280

[Done] PB 6.10 x86 ASM-backend - IMA at DeleteMapElement() with key

This code generates an IMA during the call of DeleteMapElement(). This problem only occurs with explicit key definition, only in x86, only in the ASM backend, and only with debugger on. Define NewMap Test.i() Define I.i For I = 1 To 100 AddMapElement(Test(),Str(I)) Next Debug MapSize(Test()) For I =...
by STARGÅTE
Wed Apr 03, 2024 10:08 am
Forum: Coding Questions
Topic: Beginner searching for his learning path
Replies: 16
Views: 821

Re: Beginner searching for his learning path

The only problem is.. where the start? So that's where you might be able to help me out! I know nothing about programming at the moment. So any fancy terms you throw at me are wizardry right know :D The goal is to be able to build some simple games at some point, pong would be the ultimate first go...
by STARGÅTE
Tue Apr 02, 2024 8:07 pm
Forum: Coding Questions
Topic: What is the usecase for BeginVectorLayer()/EndVectorLayer()
Replies: 3
Views: 190

Re: What is the usecase for BeginVectorLayer()/EndVectorLayer()

I use BeginVectorLayer() when I want to draw a set of overlapping figures in a half transparent way.
Without a layer, the individual figures would also blend each other.
by STARGÅTE
Mon Apr 01, 2024 4:43 pm
Forum: Tricks 'n' Tips
Topic: Revised Chr() & Asc() for UTF-16 surrogate pairs
Replies: 20
Views: 5329

Re: Revised Chr() & Asc() for UTF-16 surrogate pairs

I think your last version is the slowest due to several calls to other procedures. When we talk about speed, than we should avoid division of $400: Procedure.s _Chr(Unicode.i) Protected String.s{2} Protected *Long.Long = @String If Unicode < $10000 *Long\l = Unicode Else Unicode - $10000 *Long\l = ...
by STARGÅTE
Mon Apr 01, 2024 8:21 am
Forum: Tricks 'n' Tips
Topic: Revised Chr() & Asc() for UTF-16 surrogate pairs
Replies: 20
Views: 5329

Re: Revised Chr() & Asc() for UTF-16 surrogate pairs

Little John wrote: Sun Mar 31, 2024 8:53 pm STARGÅTE, you saved my program.
Thank you very much!
Actually, I did a mistake. PeekS only needs to read 1 character.

Code: Select all

ProcedureReturn PeekS(@high, 1, #PB_Unicode) + PeekS(@low, 1, #PB_Unicode)
by STARGÅTE
Sun Mar 31, 2024 7:01 pm
Forum: Tricks 'n' Tips
Topic: Revised Chr() & Asc() for UTF-16 surrogate pairs
Replies: 20
Views: 5329

Re: Revised Chr() & Asc() for UTF-16 surrogate pairs

Little John wrote: Sun Mar 31, 2024 5:36 pm How can we get UTF-16 surrogate pairs for characters > $FFFF e.g. with PB 6.04 and PB 6.10 :?:
Just replace Chr() with PeekS(@high, 2, #PB_Unicode) and PeekS(@low, 2, #PB_Unicode).
Little John wrote: Sun Mar 31, 2024 5:36 pm Where ist the change with PureBasic's Chr() function documented?
please remove range test from chr()