Got an idea for enhancing PureBasic? New command(s) you'd like to see?
-
IceSoft
- Addict

- Posts: 1683
- Joined: Thu Jun 24, 2004 8:51 am
- Location: Germany
Post
by IceSoft »
Get an error message with this code:
Code: Select all
CompilerIf (Subsystem("DirectX9") = 0 And Subsystem("DX9") = 0)
Will be usefull if this will be working or better: nativ DirectX7 will be also a subsystem (the default one).
So I can easily detect which subsystem is currently used
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
-
IceSoft
- Addict

- Posts: 1683
- Joined: Thu Jun 24, 2004 8:51 am
- Location: Germany
Post
by IceSoft »
A new compiler directive: CompilerElseIf is helping too.
Here a correct check which subsystem is used (with
CompilerElseIf):
Code: Select all
CompilerIf Subsystem("DirectX9")
MessageRequester("", "DirectX 9")
CompilerElseIf Subsystem("DX9")
MessageRequester("", "DX 9")
CompilerElseIf Subsystem("OpenGL")
MessageRequester("", "OpenGL")
CompilerElse
MessageRequester("", "DirectX 7")
CompilerEndIf
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
-
Trond
- Always Here

- Posts: 7446
- Joined: Mon Sep 22, 2003 6:45 pm
- Location: Norway
Post
by Trond »
And/Or/XOr are runtime operations that can't be used with CompilerIf.
You can rewrite the first code like this:
Code: Select all
CompilerIf (Subsystem("DirectX9") = 0) + (Subsystem("DX9") = 0) = 2
And the second code like this:
Code: Select all
CompilerIf Subsystem("DirectX9")
MessageRequester("", "DirectX 9")
CompilerElse : CompilerIf Subsystem("DX9")
MessageRequester("", "DX 9")
CompilerElse : CompilerIf Subsystem("OpenGL")
MessageRequester("", "OpenGL")
CompilerElse
MessageRequester("", "DirectX 7")
CompilerEndIf : CompilerEndIf : CompilerEndIf
-
IceSoft
- Addict

- Posts: 1683
- Joined: Thu Jun 24, 2004 8:51 am
- Location: Germany
Post
by IceSoft »
Trond wrote:And/Or/XOr are runtime operations that can't be used with CompilerIf.
You can rewrite the first code like this:
Code: Select all
CompilerIf (Subsystem("DirectX9") = 0) + (Subsystem("DX9") = 0) = 2
And the second code like this:
Code: Select all
CompilerIf Subsystem("DirectX9")
MessageRequester("", "DirectX 9")
CompilerElse : CompilerIf Subsystem("DX9")
MessageRequester("", "DX 9")
CompilerElse : CompilerIf Subsystem("OpenGL")
MessageRequester("", "OpenGL")
CompilerElse
MessageRequester("", "DirectX 7")
CompilerEndIf : CompilerEndIf : CompilerEndIf
@Trond,
Sweet...but all is only a workaround.
For me it looks like some guys here don't want the new compiler directive: CompilerElseIf.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
-
Trond
- Always Here

- Posts: 7446
- Joined: Mon Sep 22, 2003 6:45 pm
- Location: Norway
Post
by Trond »
For me it looks like some guys here don't want the new compiler directive: CompilerElseIf.
Feature requests are not bugs, so this is the wrong forum.
-
IceSoft
- Addict

- Posts: 1683
- Joined: Thu Jun 24, 2004 8:51 am
- Location: Germany
Post
by IceSoft »
Trond wrote:For me it looks like some guys here don't want the new compiler directive: CompilerElseIf.
Feature requests are not bugs, so this is the wrong forum.
Read my first entry of this thread and you will find why I have written it here in the bug section.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...