Quick qustion: SDL_NumJoysticks() is returning 1 - even on a N3DS. However, there should be two joysticks - the C-pad and the C-stick.
How can I get the C-stick as a joystick?
How can I get the C-stick as a joystick?
Quick qustion: SDL_NumJoysticks() is returning 1 - even on a N3DS. However, there should be two joysticks - the C-pad and the C-stick.
How can I get the C-stick as a joystick?
You have to customize the SDL code to handle the C-pad. If you try you should find that it's very easy.
Ok, thanks for clarification.
How can I have two separate SDL_Surfaces - one for top, one for bottom?
- SDL_DUALSCR: draws the upper half of the video device on the top screeen and the lower half on the bottom screen
You should look at second post of this thread:
you can also look at some of my ports on github for reference.
Using SDL_SetVideoMode(SDL_DUALSCR) you can make a surface of 320x480, so the upper 320x240 will be used for top scren (with black lateral bands) and the lower 320x240 will fil the bottom screen.
This is good if you want that sprites moves continuosly from bottom and top screen. If the two screen ae used for separate views (i.e. game and menu) you'll have to handle drawing rects for moving sprites to control that part of one screen is not drawn on the other.
You can also define a 400x480 screen, this way part of the bottom screen surface will be not visible. But this is a waste of memory and CPU (SDL is very slow on 3ds).
The last option is to use 320x480 with SDL_FULLSCREEN flag so to stretch the top screen to 400x240, while the bottom screen wll remain not stretched.
I used this option to port games with an original resolution of 320x240, like in my Zelda ports, where the main game is on top screen stretched and the menu is always visible on the bottom screen.
You can make a copy of the surface structure and make the data field to point at the first byte of the second half of the surface bits buffer.Ok, thanks for the hints. I figured as much looking on your port of Amphetamin. I guess, the software that I want to port, relies on having its own screen and has no built-in ways to display in parts of a larger screen - must validate that though. Hope, I will not need to get into the guts of the software to change that ...
There is already. But with different approach and no more maintaied.I wonder if you can make a port of SDL to the original DS
You can make a copy of the surface structure and make the data field to point at the first byte of the second half of the surface bits buffer.
Should work.
One more thing: I can't get the C-Stick or ZL/ZR buttons working. I bound them to a key with SDL_N3DSKeyBind but no event fires when I press the buttons. Do you know what I can do?
You have to customize the SDL code to handle the C-pad. If you try you should find that it's very easy.
You should use the SDL version in devkitARM. The code is the same (don't think someone updated it) but all the dependancies to build it are updated.
EDIT: I see that devkitPRO site is down.
SDL_Init(SDL_INIT_VIDEO);
SDL_Surface *screen = SDL_SetVideoMode(400, 240, 24, SDL_HWSURFACE);
SDL_Surface *image = IMG_Load ( "/image.png" );
SDL_BlitSurface ( image, NULL, screen, NULL );
SDL_Flip(screen);
Thanks, using the SDL version that comes with devkitARM works :-)
Would you please take a quick look at the following issue that I am facing?
With my code, I simply want to display a png-image on the screen, no scaling involved. However, the image shown on the screen with the code below always comes out blurry, the colors are off and there are some strange artefacts. Here the code:
Code:SDL_Init(SDL_INIT_VIDEO); SDL_Surface *screen = SDL_SetVideoMode(400, 240, 24, SDL_HWSURFACE); SDL_Surface *image = IMG_Load ( "/image.png" ); SDL_BlitSurface ( image, NULL, screen, NULL ); SDL_Flip(screen);
The image below shows the original png-image within the grey box on the left (enlarged - each black stripe is one pixel wide, original dimensions are 11x11px) and what the screen shows after executing the code above on the right. I checked the pixel data of both image and screen surface - they both look good. Seems like the issue occurrs when the screen surface is rendered to the physical 3DS screen - there are probably some unneccessary filters applied. What can I do to get the image on the screen "as is"?
View attachment 164872
--- a/VICE3DS_SDL/src/video/n3ds/SDL_n3dsvideo.c
+++ b/VICE3DS_SDL/src/video/n3ds/SDL_n3dsvideo.c
@@ -460,7 +460,7 @@ int hh= next_pow2(height);
// Setup the textures
C3D_TexInit(&spritesheet_tex, hw, hh, this->hidden->mode);
- C3D_TexSetFilter(&spritesheet_tex, GPU_LINEAR, GPU_NEAREST);
+ C3D_TexSetFilter(&spritesheet_tex, GPU_NEAREST, GPU_NEAREST);
// C3D_TexBind(0, &spritesheet_tex);
runThread = true;
Will you still merge pull requests on github?
I'm getting this error -> https://pastebin.com/Gt75iGa2
i installed sdl via pacman 3ds-sdl
# Libraries needed to link into the executable.
#---------------------------------------------------------------------------------
LIBS := -lSDL_image -lSDL_mixer -lvorbisidec -logg -lmikmod -lSDL -lmad -lz -lcitro3d -lctru -lm
#---------------------------------------------------------------------------------
Ye I managed but forgot to edit my problem, I should had read better the post, I wasn't linking citro3d, thanks anyway!It seems it can't link to citro3d.
How do you have your libraries linked in your makefile?
For example:
Code:# Libraries needed to link into the executable. #--------------------------------------------------------------------------------- LIBS := -lSDL_image -lSDL_mixer -lvorbisidec -logg -lmikmod -lSDL -lmad -lz -lcitro3d -lctru -lm #---------------------------------------------------------------------------------
Make sure to link citro3d after SDL.