Target_os_iphone

I can find this in the sdl source code but nothing similar for android. Is
there a define for android?

ANDROID gets #define’d to 1 on Android, by SDL 2.x, via the public
header, SDL_platform.h.

There’s a bunch of similar platform-specific #defines in there, too.

To note, TARGET_OS_IPHONE is not SDL specific, but is one of Apple + iOS’
own platform declaration macros. If I remember correctly, SDL uses it
under the hood to define IPHONEOS (which gets #define’d for any version
of iOS, not just those running on phone hardware).

– David L.On Mon, Oct 5, 2015 at 7:09 AM, Owen Alanzo Hogarth wrote:

I can find this in the sdl source code but nothing similar for android. Is
there a define for android?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Indeed. Check out the SDL_platform.h header to see what SDL defines on various platforms:
https://bitbucket.org/slime73/sdl-experiments/src/1fdb63e14757e2ea0a20b11c73d79fe8bb897919/include/SDL_platform.h?at=AppleTV&fileviewer=file-view-default> On Oct 5, 2015, at 4:32 PM, David Ludwig wrote:

ANDROID gets #define’d to 1 on Android, by SDL 2.x, via the public header, SDL_platform.h.

There’s a bunch of similar platform-specific #defines in there, too.

To note, TARGET_OS_IPHONE is not SDL specific, but is one of Apple + iOS’ own platform declaration macros. If I remember correctly, SDL uses it under the hood to define IPHONEOS (which gets #define’d for any version of iOS, not just those running on phone hardware).

– David L.

On Mon, Oct 5, 2015 at 7:09 AM, Owen Alanzo Hogarth <gurenchan at gmail.com <mailto:gurenchan at gmail.com>> wrote:
I can find this in the sdl source code but nothing similar for android. Is there a define for android?


SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I noticed these, the reason I asked is because after only including SDL.h I
could only use #define TARGET_OS_IPHONE_ but not ANDROID or ANDROID

getting lint errors about ANDROID not being defined.On Tue, Oct 6, 2015 at 3:43 AM, Alex Szpakowski wrote:

Indeed. Check out the SDL_platform.h header to see what SDL defines on
various platforms:

https://bitbucket.org/slime73/sdl-experiments/src/1fdb63e14757e2ea0a20b11c73d79fe8bb897919/include/SDL_platform.h?at=AppleTV&fileviewer=file-view-default

On Oct 5, 2015, at 4:32 PM, David Ludwig wrote:

ANDROID gets #define’d to 1 on Android, by SDL 2.x, via the public
header, SDL_platform.h.

There’s a bunch of similar platform-specific #defines in there, too.

To note, TARGET_OS_IPHONE is not SDL specific, but is one of Apple + iOS’
own platform declaration macros. If I remember correctly, SDL uses it
under the hood to define IPHONEOS (which gets #define’d for any version
of iOS, not just those running on phone hardware).

– David L.

On Mon, Oct 5, 2015 at 7:09 AM, Owen Alanzo Hogarth <@Owen_Alanzo_Hogarth> wrote:

I can find this in the sdl source code but nothing similar for android.
Is there a define for android?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

My understanding of how SDL_platform.h (which is #include’d indirectly by
SDL.h) works, at least on Android, is that it looks for the presence of
macros that would typically be #define’d either by the compiler, or by part
of the OS’ own SDK(s).

Maybe lint is doing something that causes these macro(s) to break?

That’s just a guess, though. I’m not sure what’s up with using lint in
Android code, alongside SDL 2.x. Perhaps someone else knows, though.

– David L.On Mon, Oct 5, 2015 at 8:18 PM, Owen Alanzo Hogarth wrote:

I noticed these, the reason I asked is because after only including SDL.h
I could only use #define TARGET_OS_IPHONE_ but not ANDROID or ANDROID

getting lint errors about ANDROID not being defined.

On Tue, Oct 6, 2015 at 3:43 AM, Alex Szpakowski wrote:

Indeed. Check out the SDL_platform.h header to see what SDL defines on
various platforms:

https://bitbucket.org/slime73/sdl-experiments/src/1fdb63e14757e2ea0a20b11c73d79fe8bb897919/include/SDL_platform.h?at=AppleTV&fileviewer=file-view-default

On Oct 5, 2015, at 4:32 PM, David Ludwig <@David_Ludwig> wrote:

ANDROID gets #define’d to 1 on Android, by SDL 2.x, via the public
header, SDL_platform.h.

There’s a bunch of similar platform-specific #defines in there, too.

To note, TARGET_OS_IPHONE is not SDL specific, but is one of Apple + iOS’
own platform declaration macros. If I remember correctly, SDL uses it
under the hood to define IPHONEOS (which gets #define’d for any version
of iOS, not just those running on phone hardware).

– David L.

On Mon, Oct 5, 2015 at 7:09 AM, Owen Alanzo Hogarth wrote:

I can find this in the sdl source code but nothing similar for android.
Is there a define for android?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I looked in SDL_platforms before mailing the list. I see that ANDROID
and ANDROID is defined in there, I am just unsure why it’s causing issues
in my code.

The lint is throwing up a warning but things compile fine, I really wish
this would go away as it’s a big eye sore working with vim and it’s
constantly highlighted.On Wed, Oct 7, 2015 at 1:04 AM, David Ludwig wrote:

My understanding of how SDL_platform.h (which is #include’d indirectly by
SDL.h) works, at least on Android, is that it looks for the presence of
macros that would typically be #define’d either by the compiler, or by part
of the OS’ own SDK(s).

Maybe lint is doing something that causes these macro(s) to break?

That’s just a guess, though. I’m not sure what’s up with using lint in
Android code, alongside SDL 2.x. Perhaps someone else knows, though.

– David L.

On Mon, Oct 5, 2015 at 8:18 PM, Owen Alanzo Hogarth <@Owen_Alanzo_Hogarth> wrote:

I noticed these, the reason I asked is because after only including SDL.h
I could only use #define TARGET_OS_IPHONE_ but not ANDROID or ANDROID

getting lint errors about ANDROID not being defined.

On Tue, Oct 6, 2015 at 3:43 AM, Alex Szpakowski wrote:

Indeed. Check out the SDL_platform.h header to see what SDL defines on
various platforms:

https://bitbucket.org/slime73/sdl-experiments/src/1fdb63e14757e2ea0a20b11c73d79fe8bb897919/include/SDL_platform.h?at=AppleTV&fileviewer=file-view-default

On Oct 5, 2015, at 4:32 PM, David Ludwig wrote:

ANDROID gets #define’d to 1 on Android, by SDL 2.x, via the public
header, SDL_platform.h.

There’s a bunch of similar platform-specific #defines in there, too.

To note, TARGET_OS_IPHONE is not SDL specific, but is one of Apple +
iOS’ own platform declaration macros. If I remember correctly, SDL uses it
under the hood to define IPHONEOS (which gets #define’d for any version
of iOS, not just those running on phone hardware).

– David L.

On Mon, Oct 5, 2015 at 7:09 AM, Owen Alanzo Hogarth <@Owen_Alanzo_Hogarth wrote:

I can find this in the sdl source code but nothing similar for android.
Is there a define for android?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I might be able to solve this issue a different way.

I am just trying to find if this instance of SDL is being ran on mobile or
desktop platform. Is there a standard way to find out is the app being run
on mobile or desktop w/o using those statements?On Wed, Oct 7, 2015 at 11:10 AM, Owen Alanzo Hogarth <@Owen_Alanzo_Hogarth> wrote:

I looked in SDL_platforms before mailing the list. I see that ANDROID
and ANDROID is defined in there, I am just unsure why it’s causing issues
in my code.

The lint is throwing up a warning but things compile fine, I really wish
this would go away as it’s a big eye sore working with vim and it’s
constantly highlighted.

On Wed, Oct 7, 2015 at 1:04 AM, David Ludwig wrote:

My understanding of how SDL_platform.h (which is #include’d indirectly by
SDL.h) works, at least on Android, is that it looks for the presence of
macros that would typically be #define’d either by the compiler, or by part
of the OS’ own SDK(s).

Maybe lint is doing something that causes these macro(s) to break?

That’s just a guess, though. I’m not sure what’s up with using lint in
Android code, alongside SDL 2.x. Perhaps someone else knows, though.

– David L.

On Mon, Oct 5, 2015 at 8:18 PM, Owen Alanzo Hogarth <@Owen_Alanzo_Hogarth> wrote:

I noticed these, the reason I asked is because after only including
SDL.h I could only use #define TARGET_OS_IPHONE_ but not ANDROID or
ANDROID

getting lint errors about ANDROID not being defined.

On Tue, Oct 6, 2015 at 3:43 AM, Alex Szpakowski wrote:

Indeed. Check out the SDL_platform.h header to see what SDL defines on
various platforms:

https://bitbucket.org/slime73/sdl-experiments/src/1fdb63e14757e2ea0a20b11c73d79fe8bb897919/include/SDL_platform.h?at=AppleTV&fileviewer=file-view-default

On Oct 5, 2015, at 4:32 PM, David Ludwig wrote:

ANDROID gets #define’d to 1 on Android, by SDL 2.x, via the public
header, SDL_platform.h.

There’s a bunch of similar platform-specific #defines in there, too.

To note, TARGET_OS_IPHONE is not SDL specific, but is one of Apple +
iOS’ own platform declaration macros. If I remember correctly, SDL uses it
under the hood to define IPHONEOS (which gets #define’d for any version
of iOS, not just those running on phone hardware).

– David L.

On Mon, Oct 5, 2015 at 7:09 AM, Owen Alanzo Hogarth < @Owen_Alanzo_Hogarth> wrote:

I can find this in the sdl source code but nothing similar for
android. Is there a define for android?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Owen Alanzo Hogarth wrote:

I might be able to solve this issue a different way.

I am just trying to find if this instance of SDL is being ran on mobile or desktop platform. Is there a standard way to find out is the app being run on mobile or desktop w/o using those statements?

There is also a function, ‘const char * SDL_GetPlatform(void)’, which will return a string that attempts to identify the current platform. Under the hood, it uses a bunch of #if/#elif/#endif directives on those SDL #defines (like ANDROID, IPHONEOS, WIN32, etc.), to figure out which string to return.

– David L.