Author Topic: Native now has SDL  (Read 22742 times)

spn-x

  • *
  • Posts: 109
Re: Native now has SDL
« Reply #20 on: August 22, 2010, 10:34:18 am »
Ok, is there any chance to code with OSX ? Or do i have to use my WIN Laptop ?
My Dingoo : Dingux // dmenu 0.3 ; gmenu2x // Native : FW 1.2
                    Joystick Mod

joyrider

  • *
  • Posts: 220
    • Willems Soft
Re: Native now has SDL
« Reply #21 on: August 22, 2010, 10:41:03 am »
Ok, is there any chance to code with OSX ? Or do i have to use my WIN Laptop ?

Gcc tools exist for mac, but i do not think there is a "all in one" package downloadable for mac, unless a dev that uses mac has created one and upload it somewhere. This means it is possible, i'm pretty sure of it but you would have to compile the (cross)compiler yourselve from sources and that's a dauting task. Once you have that you can probably just use the dingoo sdk as usual ...

do some googling around

this is some info of the gcc tools (used with the dingoo sdk for native that flatmush made)
$ mipsel-linux-gcc -v
Using built-in specs.
Target: mipsel-linux
Configured with: ../src/configure --target=mipsel-linux -enable-languages=c++ --
host=i686-pc-linux-gnu --prefix=/cygdrive/d/user/daniel/work-gcc/tools/mipsel-gc
c4.1-nopic --disable-multilib --disable-shared --with-headers=/cygdrive/d/user/d
aniel/work-gcc/tools/mipsel-gcc4.1-nopic/mipsel-linux/include
Thread model: posix
gcc version 4.1.2

mipsel-gcc4.1-nopic

it might be wise if you start from source to perhaps use the exact same version and use the same configure flags etc


spn-x

  • *
  • Posts: 109
Re: Native now has SDL
« Reply #22 on: August 22, 2010, 11:39:43 am »
Ok, then i'll try it with Windows ..
My Dingoo : Dingux // dmenu 0.3 ; gmenu2x // Native : FW 1.2
                    Joystick Mod

joyrider

  • *
  • Posts: 220
    • Willems Soft
Re: Native now has SDL
« Reply #23 on: August 22, 2010, 12:19:06 pm »
Ok, then i'll try it with Windows ..

if you'd really like to work on your mac for example because you don't like laptop keyboards (like me) or other reason's like you have other programma's you use constantly on your mac... Try looking for some vnc like tool or some other remote desktop program that works on both windows and mac, you can the basically take over your laptop on your mac and do whatever you like.

You could also create a samba share to the files on your windows laptop so you can edit the files on your mac using mac tools which you like and are used too. and just use the remote desktop to run cygwin and compile...

I can suggest code::blocks which exists for mac (i use it myselve).. although it's a preference...

as far as a remote desktop tool teamviewer (www.teamviewer.com) seems like a viable option it's easy to use and works on both windows and mac, and free for non comercial use, so you can do what i suggested above ..
« Last Edit: August 22, 2010, 12:21:35 pm by joyrider »

Harteex (OP)

  • * Administrator
  • Posts: 709
    • Harteex Productions
Re: Native now has SDL
« Reply #24 on: August 22, 2010, 02:07:17 pm »
@harteex : Do u think it would be easier to start with dingux ? Or is there no difference between Native and Dingux.
Well, as for Dingux you can start with any SDL tutorial for windows/linux as there is no difference between that platforms and Dingux :)

Same for SDL for native pretty much, the only thing you need specifically is a makefile.
If you want to move your game/app to the dingoo, make sure you use 320x240 graphics resolution.

Harteex (OP)

  • * Administrator
  • Posts: 709
    • Harteex Productions
Re: Native now has SDL
« Reply #25 on: August 24, 2010, 12:06:53 am »
I've made a simple Pong sample to show C++ and SDL, you can find it in the SVN repository:
http://code.google.com/p/dingoo-sdk/source/browse/#svn/trunk/dingoo_sdk/samples/SDLPong

From the readme:
Quote
This sample is more meant to be a sample than to be a game.
It's currently not very exciting to play because it's easy to predict how the ball bounces.

The sample provides the following:
* A makefile for C++ / SDL
* An example game loop (there are many different ways of doing this, probably many better ways also)
* SDL_image usage (png splash screen)
* SDL_mixer usage (sound and music)
* SDL_ttf usage (fonts and text)
* A way to handle keys

joyrider

  • *
  • Posts: 220
    • Willems Soft
Re: Native now has SDL
« Reply #26 on: August 24, 2010, 12:59:05 am »
Hey harteex,

i noticed the function "static void SLCD_UpdateRects(_THIS, int numrects, SDL_Rect *rects)"

Doesn't take into account the rects param yet, so in other words your always flipping the whole screen, even when users didn't ask for this (by for example not calling SDL_Flip but calling SDL_Updaterect or something) that has a kind of performance impact, since in such cases the user (well programmer) doesn't want to update the whole screen, but only a part of it to gain speed (which we don't now) ... I think it can't be too hard to do this, since it's always a rect so you could calculate starting offset  (top left corner of rect) in the real screen,  and then calculate based the rectheight and rectwidth and update one line at a time for the rectangle adding each time the offset to the next starting point, that should speed up certain games or at least do what the user asked or expected, since now it doesn't make a diffrence :)

Harteex (OP)

  • * Administrator
  • Posts: 709
    • Harteex Productions
Re: Native now has SDL
« Reply #27 on: August 24, 2010, 01:52:13 am »
Yea, you're right. That was one of the first things I did (the actual code is copy-pasted from flatmush SML stuff), and I kind of forgot about it.

I'll look into it when I have time, should have some the next couple of days.

BTW, if any dev wants to contribute code to the SDK and/or SDL, I could give you commit access.

joyrider

  • *
  • Posts: 220
    • Willems Soft
Re: Native now has SDL
« Reply #28 on: August 24, 2010, 08:19:55 am »
i'm not into svn's etc only for downloading sources hehe, since i'm affraid to mess things up... but i'll send you the things i did to include SDL_Gfx, you don't actually have to do anything for it to work, except modify the header files for it (like replace <header> with "header". The rest worked out of the box (well it compiled the sdl lib at least with it in it) since it works on top SDL, i couldn't actually test all the functions yet, since i haven't messed around with my sokoban game anymore... might do sometime this week... but i think they should work :)

joyrider

  • *
  • Posts: 220
    • Willems Soft
Re: Native now has SDL
« Reply #29 on: August 25, 2010, 11:33:15 am »
Harteex, i played a bit with the sdl source and got an idea that might help certain apps / games (specifically emulators most of the time), when they are written in a certain way ...

Looking at the sdl source for native, it's basically always using double buffering since you do the following :
this->hidden->buffer = SDL_malloc(width * height * (bpp / 8));

and afterwards with the updaterects, you write the temporary surface to the real dingoo screen using slcd_getframe and setframe...
so thats actually double buffering ... I understand why you did this though, because if you don't and you do 2 blits on the same spot you get flickering, i've come accross that on the gp2x as well..

However some people know about this and can use it to their advantages gaining 7 extra fps according to my tests (when blitting a 320x240 image as fast as the dingoo can to the screen)

so here's an idea :
keep your current setup but only activate it when SDL_DOUBLEBUFF flag is set


when the flag is not set just do this : (it's only a few changes but you have to watch out not to free the hidden buffer then on a few places in the code)

this->hidden->buffer = lcd_get_frame();

and in the update rects do only this :

if (this->hidden->buffer == NULL)
      return;
  __dcache_writeback_all();
  lcd_set_frame();

that way you give people the option to either use a double buffer or not and for those who don't need it they can get extra speed given they don't blit a surface "over" each other before flipping the screen plus more free ram because a second buffer is not allocated

it would be even better to make an adopted function from the function on this page : http://wakaba.c3.cx/w/dingoo_coding
SendLCDFrame(uint16_t *frame)

because then you can take the rect into account as well, by only updating the places on the screen that need it (when not using double buffer) since the current  lcd_set_frame(); always writes back the whole screen i think ..

not sure who's the author of that site though
« Last Edit: August 25, 2010, 11:39:18 am by joyrider »

Harteex (OP)

  • * Administrator
  • Posts: 709
    • Harteex Productions
Re: Native now has SDL
« Reply #30 on: August 25, 2010, 04:53:25 pm »
Very nice, thanks a lot for your ideas :)
I will definitely look into this.

SDL_DOUBLEBUF is not valid together with SDL_SWSURFACE so I think I will keep the current way (but fix the rects updating) for this type.

For SDL_HWSURFACE, I will try drawing to lcd_get_frame() directly and for DOUBLEBUF the SendLCDFrame function approach.

Harteex (OP)

  • * Administrator
  • Posts: 709
    • Harteex Productions
Re: Native now has SDL
« Reply #31 on: August 28, 2010, 04:52:46 pm »
If you grab the latest SDL code from SVN, it now updates the rects as it should and not just the whole screen.

I also filed a google code issue on the HWSURFACE ideas: http://code.google.com/p/dingoo-sdk/issues/detail?id=51

alekmaul

  • *
  • Posts: 330
    • Portabledev
Re: Native now has SDL
« Reply #32 on: September 05, 2010, 07:01:31 am »
Just one question Harteex, i testeed a port of a game and i think SDL for dingoo does not support timer callback, do you confirm this fact ?

Harteex (OP)

  • * Administrator
  • Posts: 709
    • Harteex Productions
Re: Native now has SDL
« Reply #33 on: September 05, 2010, 01:52:31 pm »
Yea, they don't work currently. I'll see if I can fix that, and post back if I do.

alekmaul

  • *
  • Posts: 330
    • Portabledev
Re: Native now has SDL
« Reply #34 on: September 05, 2010, 06:00:44 pm »
ok, so it's not a pb from my port ^^
thanks for your fast reply ^^

Yongary

  • Guest
Re: Native now has SDL
« Reply #35 on: September 09, 2010, 01:59:48 am »
Does this mean that we can finally get a Dingoo version of Cave Story?

Cave Story SDL link: http://sourceforge.net/projects/cavestory/

zear

  • * Moderator
  • Posts: 2379
Re: Native now has SDL
« Reply #36 on: September 09, 2010, 10:48:23 am »
Does this mean that we can finally get a Dingoo version of Cave Story?

Cave Story SDL link: http://sourceforge.net/projects/cavestory/

Cave Story is not open source. This thing is a try to rewrite the engine, but AFAIK it's not working and is long abandoned ;)

Edit: I found a fresh and very complete engine reimplementation for Cave Story. It's called NXEngine. I gave it a try on Dingux and that's the result: http://www.youtube.com/watch?v=dUFO48HiXhg
« Last Edit: September 09, 2010, 02:12:17 pm by zear »

Harteex (OP)

  • * Administrator
  • Posts: 709
    • Harteex Productions
Re: Native now has SDL
« Reply #37 on: September 09, 2010, 02:52:27 pm »
ok, so it's not a pb from my port ^^
thanks for your fast reply ^^

I think I will have very limited time for dingoo coding for a while, so this might take some time.
You could replace the timers with the standard SDL_GetTicks if it's easy to do in the port, or wait with it to a later time.

nzeemin

  • Guest
Re: Native now has SDL
« Reply #38 on: September 17, 2010, 08:49:29 am »
Harteex, looks like SDL has the bug with X button: if the button pressed for long time (about 3 sec) the program quits.
That's standard "feature" of sys_judge_event -- Tim0xA was first who found it: http://boards.dingoonity.org/dingoo-development/platform-independant-dingoo-sdk/msg17853/#msg17853
So now all SDL-based games build with dingoo-sdk have the same "feature".

Harteex (OP)

  • * Administrator
  • Posts: 709
    • Harteex Productions
Re: Native now has SDL
« Reply #39 on: September 17, 2010, 10:56:10 am »
It's not really bug, but a feature in the OS. There are two ways you can use to fix it:

Either, before SDL init, do SDL_putenv("DINGOO_IGNORE_OS_EVENTS=1");
This is a dingoo specific flag to ignore the system events.

Otherwise you may also simply look for this code: if (event.type == SDL_QUIT)
and comment out the code so that you don't do anything on a quit event.

 

Post a new topic