¡Oh no! ¿Dónde está el JavaScript? El navegador Web no tiene JavaScript activado o no es compatible con JavaScript. Active JavaScript en su explorador Web para ver correctamente este sitio Web o actualizar a un navegador Web que admita JavaScript.
Sabías que...
Desde la muerte comercial de Dreamcast, se ha lanzado (2013) como mínimo un juego comercial no licenciado cada año. La única excepción fue en 2011.

¿Cómo establecer SDL para trabajar en Kos?

Última actualización en 7 year hace
NeoSnkNeoSnkMiembro Júnior
Publicado 8 year hace
Hola mis amigos, he hecho un simple juego de plataformas usando SDL en PC, y me gustaría poder portarlo para la Dreamcast. Sin embargo mucha gente dice que SDL en Dreamcast no es bueno ... Pero después de investigar vi un juego de Zelda para Dreamcast funcionando muy bien que utiliza SDL. Así es SDL tan malo como todo el mundo dice?

¿Cómo puedo iniciar mi puerto SDL juego de PC para Dreamcast? Ya tengo KOS en mi pc.

(Sorry for my bad Spanish haha).
Editado por NeoSnk en 20-09-2016 02:04, 8 year hace
IndiketIndiketAdministrador
Publicado 8 year hace
SDl is not as bad as it seems! Works fairly nice, and you only have to know some basic things to get it working :)

Start looking at some source codes of SDL games, from this websiter or another. You will see how to init SDL, which lib does it use (I think latest KOS has SDL 1.2.15 already in kos-ports), etc etc.
NeoSnkNeoSnkMiembro Júnior
Publicado 8 year hace

Cita

Indiket ha escrito:

SDl is not as bad as it seems! Works fairly nice, and you only have to know some basic things to get it working :)

Start looking at some source codes of SDL games, from this websiter or another. You will see how to init SDL, which lib does it use (I think latest KOS has SDL 1.2.15 already in kos-ports), etc etc.



Ohh great, I've never worked on KOS before, that's why I'm lost... I always used Bennu for Dreamcast, but for this project I want to learn something new...

First of all I want set SDL working with a simple "HELLO_WORLD"...

So, I went to kos-ports -> SDL -> inst Then a copied the folders include and lib.

Inside the folder kos -> addons I pasted and merged the folders include and lib

Then inside my folder kos->Projects->helloword
i've created main.cpp and my MakeFile

My MakeFile

Code:

all: rm-elf main.elf

include $(KOS_BASE)/Makefile.rules

OBJS = main.o
   
clean:
   -rm -f main.elf $(OBJS)
   
clean-all:
   -rm -f main.elf $(OBJS) main.iso output.bin Program.cdi 1st_read.bin

dist:
   -rm -f $(OBJS)
   $(KOS_STRIP) main.elf
   
rm-elf:
   -rm -f main.elf

main.elf: $(OBJS)
   $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $@ $(KOS_START) $^ -lm $(KOS_LIBS)


My main.cpp


#include <kos.h>
#include <SDL/SDL.h>

int main(void)
{
    return 0;
}




Ok when I try to compile it works, I just want to know... is the structure correct? or am I missing something? sorry man for such a dumb question... but like I said I'm totally new working on KOS haha.
IndiketIndiketAdministrador
Publicado 8 year hace
You will need to add SDL library into the linking process (cause when you start to use SDL functions, you will get undefined errors at linking stage).

Just add "-lSDL" into the compile line, like this:

$(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $@ $(KOS_START) $^ -lSDL -lm $(KOS_LIBS)
NeoSnkNeoSnkMiembro Júnior
Publicado 8 year hace

Cita

Indiket ha escrito:

You will need to add SDL library into the linking process (cause when you start to use SDL functions, you will get undefined errors at linking stage).

Just add "-lSDL" into the compile line, like this:

$(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $@ $(KOS_START) $^ -lSDL -lm $(KOS_LIBS)



Amazing man, thank you so much! When I finish my game I will be sure to put your name in the credits for helping me hehehe!
NeoSnkNeoSnkMiembro Júnior
Publicado 8 year hace
Man, I got the SDL working thank you so much!!! Now I'm starting to port my game from PC to DC, however only one thing is not working now. Everytime I use the delete or the new operator, i get a linker error such as "undefined reference to `operator delete(void*)".

I'm not sure, but I think my MakeFile is pointing to the C Compiler instead of pointing to the C++ one, am I right?

So I tried to add this:

main.elf: $(OBJS)
$(KOS_CC) $(KOS_CFLAGS) $(KOS_CPPFLAGS) $(KOS_LDFLAGS) -o $@ $(KOS_START) $^ -lSDL -lm $(KOS_LIBS)

But I get the same error, should I change it in another place?
IndiketIndiketAdministrador
Publicado 8 year hace
Nope, just add the C++ library to link!!: -lstdc++
NeoSnkNeoSnkMiembro Júnior
Publicado 8 year hace

Cita

Indiket ha escrito:

Nope, just add the C++ library to link!!: -lstdc++


Man, Thanks again! You are the king haha! it is working now \o/
NeoSnkNeoSnkMiembro Júnior
Publicado 7 year hace
Man I'm really impressed how DC handles SDL. It's the same thing of creating a game for PC :O:O:O

Thank you so much, do you have some recommendation? or something I shouldn't do? For now I don't have any problems! Everything works perfectly and smooth.
Editado por NeoSnk en 23-09-2016 05:45, 7 year hace
NeoSnkNeoSnkMiembro Júnior
Publicado 7 year hace
Now I have just one problem... When I try to map my Joystick I have this error:

undefined reference to 'SDL_DC_MapKey', I realized the games from this website use -lSDL_129 instead of -lSDL . However the 129 version is the one made by Chui right? and I think it is a old version... is there a similar function for the most recent version or should I use the Chui's one?
IndiketIndiketAdministrador
Publicado 7 year hace
SDL_DC_Mapkey is only available in Chui's SDL version, so you won't find it in the KOS one. -lSDL_129 is from the Chui's version, right.

You can try to read using joystick buttons instead of PC keyboard keys, so you won't need this function.
NeoSnkNeoSnkMiembro Júnior
Publicado 7 year hace

Cita

Indiket ha escrito:

SDL_DC_Mapkey is only available in Chui's SDL version, so you won't find it in the KOS one. -lSDL_129 is from the Chui's version, right.

You can try to read using joystick buttons instead of PC keyboard keys, so you won't need this function.


I'll try that!!! Thank you man
NeoSnkNeoSnkMiembro Júnior
Publicado 7 year hace
Yes man, it worked... I'll leave the code here in case someone need it.


////Starting the Joystick
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK);
SDL_JoystickEventState(SDL_ENABLE);
joystick = SDL_JoystickOpen(0);
buttonCount = SDL_JoystickNumButtons(joystick);


And here to get the events:


   switch(event.type)
   {
            case SDL_JOYBUTTONDOWN:
         
             switch(event.jbutton.button)
            {                   
                                    case 0:
                                         ////// A Button Dreamcast Joystick
                                    break;                  
                                   
                                    case 1:
                                         ////// B Button Dreamcast Joystick
                                    break;      

                                    case 2:
                                         ////// X Button Dreamcast Joystick
                                    break;      

                                    case 3:
                                         ////// Y Button Dreamcast Joystick
                                    break;      

            }
         break;
         
      case SDL_JOYHATMOTION:
            
             switch(event.jhat.value)
            {
                                        case 2: //right

               break;
               
                                        case 8:  //left

               break;
               
               case 0: //neutral

               break;
            }
         break;   
          }
NeoSnkNeoSnkMiembro Júnior
Publicado 7 year hace
Hey Indiket, my last question for you man hahahahaha!!!

I followed all the examples and I'm using the resolution 320x240. It's working really great and fast!! (I've tried 640x480 but it hasn't the same performance) . However when the Dreamcast get it and transform in Full-screen the images get a little bit fuzzy. Something that doesn't happen with the other games.

It's like the DC is set for 640x480 and it gets my game in 320x240 and stretch it to fill the screen.

So, my question is... Is there some way to set the DC to work in 320x240 instead of its native resolution? or is there some trick to get the images better like the other games?

Thank you bro!
NeoSnkNeoSnkMiembro Júnior
Publicado 7 year hace
I think I found the problem. I was testing using VGA Mode, when I test using normal mode it doesn't get fuzzy hehe! Tks man.
puede ver todos los hilos de discusión en este foro.
puede iniciar un nuevo hilo de discusión en este foro.
no puede responder en este hilo de discusión.
no puede empezar en una encuesta en este foro.
puede cargar archivos adjuntos en este foro.
no puede descargar archivos adjuntos en este foro.
Afiliados
SEGA Saturno - Saturn, SEGA y Videojuegos