Search found 1799 matches

by STARGÅTE
Fri Apr 19, 2024 9:13 pm
Forum: Bugs - Windows
Topic: [Done] Static array index-less reference
Replies: 9
Views: 532

Re: [Done] Static array index-less reference

I can add an exception when used with '@', would it cover all the cases ? Makes sens, I will revert this check then. Definitely the better choice for now. However, at this point, we should think a little more carefully about the consistency of PureBasic. The report of Joubarbe is reasonable. The as...
by STARGÅTE
Fri Apr 19, 2024 2:07 pm
Forum: Coding Questions
Topic: Thread Parameters?
Replies: 13
Views: 611

Re: Thread Parameters?

@STARGÅTE: Thanks for showing that. I should switch my Delays() to Semaphores() then for my threads? But, can I just use the one semaphore for all my different threads, or does each thread need its own dedicated semaphore? What I mean is, is doing it like this safe? It appears to be. Semaphores gua...
by STARGÅTE
Fri Apr 19, 2024 7:49 am
Forum: Coding Questions
Topic: Thread Parameters?
Replies: 13
Views: 611

Re: Thread Parameters?

In both cases the information is passed just as a reference to the thread, and not as a variable or copy. That's why my example has "text$=PeekS(params)" as the first line of the thread: to create a local copy of the params so they're not lost. Sometimes you'll need a small delay after cr...
by STARGÅTE
Thu Apr 18, 2024 9:27 pm
Forum: Bugs - Windows
Topic: [Done] Static array index-less reference
Replies: 9
Views: 532

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: 13
Views: 611

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: 563

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: 338

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: 362

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: 362

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: 362

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: 513

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: 513

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: 364

[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: 835

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: 192

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.