#include <3ds.h>
#include <sf2d.h>
#include <stdio.h>
#include <string.h>
#define CONFIG_3D_SLIDERSTATE (*(volatile float*)0x1FF81080)
#define WIDTH 400
#define HEIGHT 240
#define SCREEN_SIZE WIDTH * HEIGHT * 2
#define BUF_SIZE SCREEN_SIZE * 2
extern const struct images
{
unsigned int width;
unsigned int height;
unsigned int bytes_per_pixel;
unsigned char pixel_data[];
} logo, background;
int main()
{
sf2d_init();
sf2d_set_3D(true);
sf2d_set_clear_color(RGBA8(0x00, 0x00, 0x00, 0x00));
float offset = 0;
sf2d_texture *sfBackground = sf2d_create_texture_mem_RGBA8(background.pixel_data, background.width, background.height, TEXFMT_RGBA8, SF2D_PLACE_RAM);
sf2d_texture *sfShip = sf2d_create_texture_mem_RGBA8(logo.pixel_data, logo.width, logo.height, TEXFMT_RGBA8, SF2D_PLACE_RAM);
while (aptMainLoop()) {
offset = CONFIG_3D_SLIDERSTATE * 10;
hidScanInput();
if (hidKeysDown() & KEY_START) break;
sf2d_start_frame(GFX_TOP, GFX_LEFT); // render for left eye
sf2d_draw_texture(sfBackground, 0, 0);
sf2d_draw_texture(sfShip, 80, 30);
sf2d_end_frame();
sf2d_start_frame(GFX_TOP, GFX_RIGHT); // render for right eye
sf2d_draw_texture(sfBackground, 0, 0);
sf2d_draw_texture(sfShip, 80 - offset, 30);
sf2d_end_frame();
sf2d_swapbuffers();
}
sf2d_fini();
return 0;
}