Can @Require be optional?

Discuss any general programming issues here
Post Reply
Bugala
Posts: 1434
Joined: Sun Feb 14, 2010 7:11 pm

Can @Require be optional?

Post by Bugala »

Is there any way to do something like:

Code: Select all

If A=1
@Require "plugin"
EndIf

For I tried that one, but even I set A into something else than 1, it still said "this program requires Plugin"
Flinx
Posts: 384
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Can @Require be optional?

Post by Flinx »

@REQUIRE is a preprocessor command. It does not exist during normal program execution; rather, it triggers an action by the preprocessor that takes place before the program actually starts. During normal program execution, preprocessor directives have no direct effect, so you can place them anywhere in the code. When the preprocessor executes this command, the variable A doesn't even exist yet.
plouf
Posts: 739
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Can @Require be optional?

Post by plouf »

and why to do it, anyway? whats the purpose behind this ?

if target is to NOT fail loading if user does NOT have it, you either include (link=true) or use @OPTIONAL instead so script not fails

if the target is to create multitarget apps , e.g. an app with jpeg support and an app with PNG support
you must use @IF (preprocessor if) to exclude loading plugin
i.e. preprocessor @IF CAN do it ..in preprocessor time..
Christos
Bugala
Posts: 1434
Joined: Sun Feb 14, 2010 7:11 pm

Re: Can @Require be optional?

Post by Bugala »

Thanks for the "link" command. I forgot you can do that, since I was already wondering if user needs to have the hwp, but with link it comes part of exe. This should solve the problem.

Although, depends how RebelSDL works.

For point is, it mentions that when using RebelSDL, drawing circles might become slower, which could be making difference in this case.

It also mentions in instructions that just @REQUIRE RebelSDL and it will basically be working, although it still mentions having to use Hardware doublebuffer and Hardware brushes.

So point here is that in case someone doesnt want to use RebelSDL, due to circles being drawn slower, then is it possible to have it on/off.

As in, if I use @REQUIRE rebelSDL, will drawing commands then automatically go through RebelSDL in way of using the slower Circle, or will it only use those slower/faster drawing methods, if I first turn Hardware DoubleBuffer on?

As in, if I @REQUIRE RebelSDL and then never use Hardware doublebuffer nor brushes, will it then work just like RebelSDL wasnt @required in the first place?

Or will it already @REQUIRE wrap the Circle command and Cirlce command become slower, regardless if I use Hardware DoubleBuffer and brushes or not.
plouf
Posts: 739
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Can @Require be optional?

Post by plouf »

yes as i recall, plugins like rebelsdl , take over , fully replace graphics layer with their own

so RebelSDL / Rapagui etc can NOT be "optional"
Christos
Bugala
Posts: 1434
Joined: Sun Feb 14, 2010 7:11 pm

Re: Can @Require be optional?

Post by Bugala »

Okay, then in that case it could be good that @REQUIRE would be optional, unless there would be some other way to turn them on/off, since it is a possibility that circles could be the main slow down on my game (I dont think it really is, but without testing I cant be sure), and therefore there could be a situation where with better graphics card RebelSDLs benefits overcome the circle problem greatly, but with lousier graphics card it might not.

I mean, I assume that if you dont have a graphics card, then circle slowdown wrapping doesnt happen, or does it?

But does the circle slowdown happen, unless Hardware doublebuffer is used first?

as in, would Hardware DoubleBuffer actually work as On/Off button for RebelSDL circle slowdown?
Post Reply