Notices


Reply
Thread Tools
Posts: 303 | Thanked: 145 times | Joined on Aug 2009
#1
If I have a SDL2 app, full screen, that uses no library (other than SDL2), can I just compile/link it and it will run?
 

The Following User Says Thank You to Radu For This Useful Post:
Posts: 48 | Thanked: 85 times | Joined on Mar 2017
#2
Hi,

Take this with a pinch of salt, as I don't really know what I'm doing, and I'm not sure if this is relevant...
But when I compiled ffplay (part of ffmpeg), I found that all the graphical stuff worked fine, but I didn't get any audio.
I did manage to get audio working (http://talk.maemo.org/showpost.php?p...46&postcount=9).

HTH
 

The Following 2 Users Say Thank You to moodroid For This Useful Post:
Posts: 303 | Thanked: 145 times | Joined on Aug 2009
#3
Thanks for the reply. I am trying to decide if it's worth it to get a second hand phone, like a Xiaomi mi4 to play with.

Do you, by any chance, care to give this a try? https://github.com/raduprv/1-million-particles
You just have to compile it and link with -lSDL2main -lSDL2

It's an app that I wrote a few years ago for Android, and I just released the source today. The Android app is here:
https://play.google.com/store/apps/d...ary.mparticles
 

The Following User Says Thank You to Radu For This Useful Post:
Posts: 48 | Thanked: 85 times | Joined on Mar 2017
#4
Hi Radu,

I've had a quick go, but like I say, I'm just playing, and don't really know what I'm doing...

It didn't seem to like:

#ifndef _WIN32
mkdir(config_path, (S_IRWXU|S_IRWXG|S_IRWXO));
#else
mkdir(config_path);
#endif

and gave

main.c: In function 'get_configh_path':
main.c:287:23: error: 'S_IRWXU' undeclared (first use in this function)
mkdir(config_path, (S_IRWXU|S_IRWXG|S_IRWXO));
^
main.c:287:23: note: each undeclared identifier is reported only once for each function it appears in
main.c:287:31: error: 'S_IRWXG' undeclared (first use in this function)
mkdir(config_path, (S_IRWXU|S_IRWXG|S_IRWXO));
^
main.c:287:39: error: 'S_IRWXO' undeclared (first use in this function)
mkdir(config_path, (S_IRWXU|S_IRWXG|S_IRWXO));
^

So, I changed it to '#ifdef _WIN32' just to see what would happen, and it then compiled with:
gcc main.c -lSDL2 -I/usr/include/SDL2 -lm

When I run it, it brings up an options screen in portrait and because my device is only 540 x 960, a lot of it was cut off the edge of the screen.

But most importantly, I wasn't able to interact with it. Touching the buttons and controls didn't do anything, and I don't know if it has any keyboard options? When I compiled ffplay, it didn't have any touch controls and was controlled by the keyboard, so maybe touch stuff doesn't work? Perhaps someone who knows more about it can advise...
 

The Following 2 Users Say Thank You to moodroid For This Useful Post:
Posts: 303 | Thanked: 145 times | Joined on Aug 2009
#5
Thanks a lot!

Can you please try to put #define __ANDROID__ somewhere at the very beginning, and just comment out the lines like:

Code:
#ifdef __ANDROID__
    Android_JNI_GetAccelerometerValues(last_accel_values);
    last_got_accel=SDL_GetTicks();
#endif
Also, in get_config_path() just change it to:
Code:
void get_configh_path()
{
	strcpy(config_path,getenv("HOME"));
	mkdir(config_path);
}
Maybe if you do that it will be full screen and touch will work.
 

The Following User Says Thank You to Radu For This Useful Post:
Posts: 48 | Thanked: 85 times | Joined on Mar 2017
#6
Have done that, but it doesn't seem to have made any difference, sorry. Just did some searching, and it does sound like there may be issues with landscape and touch with sdl on Sailfish?
 
Posts: 303 | Thanked: 145 times | Joined on Aug 2009
#7
That sucks.
Was it at least full screen, with the right dimensions (window not being cut)?
When it started, was it in landscape mode?

If there are issues with SDL in landscape mode, I guess there's not a good chance to port many games and apps to Sailfish :/
 

The Following User Says Thank You to Radu For This Useful Post:
Posts: 48 | Thanked: 85 times | Joined on Mar 2017
#8
Hi. It was full screen, but it immediately went into portrait mode and won't rotate, so options screen was cut off - it was the same with ffplay.
Maybe there is a solution out there, or maybe someone else will reply.
Sorry it isn't better news.
 

The Following User Says Thank You to moodroid For This Useful Post:
Posts: 303 | Thanked: 145 times | Joined on Aug 2009
#9
I wonder if there is any option to make it not do that. I wish I could find a nice SDK with well documented APIs for Sailfish.
 

The Following User Says Thank You to Radu For This Useful Post:
Posts: 570 | Thanked: 976 times | Joined on Dec 2012
#10
You can try my nested compositor qxcompositor from openrepos.
I was able to compile your app but without #define __ANDROID__ so don't know whether touch will works correctly.
Attached Images
 
__________________
My Thumb repo
 

The Following 4 Users Say Thank You to elros34 For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 23:09.