Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Compiler Directives / Preprocessor AGK2 Tier-1

Author
Message
Steve Ancell
18
Years of Service
User Offline
Joined: 16th Feb 2006
Location: Brighton, East Sussex, UK
Posted: 31st Jan 2018 01:03 Edited at: 31st Jan 2018 01:05
Does AGK2 have any kind of preprocessor directives features?, in other words is it possible to do different versions of code for different platforms, something like the following?...


PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 31st Jan 2018 01:52 Edited at: 31st Jan 2018 01:54
No compiler directive for that but you can use GetDeviceBaseName()

EG:
Steve Ancell
18
Years of Service
User Offline
Joined: 16th Feb 2006
Location: Brighton, East Sussex, UK
Posted: 31st Jan 2018 08:16
I did originally look at GetDeviceBaseName(). I was hoping for some kind of compiler directive, so that I can use one set of function names, but I guess I'm just gonna have to do it the way you show in your example.

Thanks for the advice.
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 31st Jan 2018 16:21
Well you can have one set of function names for the main scripts just use the select statement inside your main function to trigger device dependant code.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 31st Jan 2018 16:48 Edited at: 31st Jan 2018 16:50
you can use GetDeviceBaseName maybe like this
AGK (Steam) V2017.12.12 : Windows 10 Pro 64 Bit : AMD (17.12.1) Radeon R7 265 : Mac mini OS High Sierra (10.13)
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 31st Jan 2018 21:03
I did not know I could do that with constants..
Ortu
DBPro Master
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 3rd Feb 2018 04:02 Edited at: 3rd Feb 2018 04:05
Quote: "I did not know I could do that with constants.."


You can do quite a lot with constants really. They are essentially a token:string pair that get pre-processed at compile time to inject the raw text of the string into the source code at any instance of token, meaning you can inject just about anything including more source code not just simple values.



Effectively becomes on compile:



much more readable I think, and more convenient to write too
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 3rd Feb 2018 13:23
Is this in the documentation or in tutorials?
Ortu
DBPro Master
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 3rd Feb 2018 15:19 Edited at: 3rd Feb 2018 15:19
Probably not

But they worked that way in DBPro also, probably even DBClassic as well, though I don't remember for sure.
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.

Login to post a reply

Server time is: 2024-11-24 02:32:43
Your offset time is: 2024-11-24 02:32:43