Nintendo 3DS >> C/C++ >> SDL v1.2

Pixels Manipulation


參考資訊:
1. libctru doc
2. 3ds-examples

main.c

#include <stdio.h>
#include <stdlib.h>
#include <SDL.h>
 
int main(void)
{
    SDL_Surface *screen = NULL;

    SDL_Init(SDL_INIT_VIDEO);
    screen = SDL_SetVideoMode(400, 240, 16, SDL_HWSURFACE);

    int x = 0, y = 0;
    uint16_t *d = screen->pixels;
    for (y = 0; y < screen->h; y++) {
        for (x = 0; x < screen->w; x++) {
            *d++ = 0xf800;
        }
    }

    SDL_Flip(screen);
    SDL_Delay(3000);
    SDL_Quit();
    return 0;
}

完成


返回上一頁