Making game with SDL2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
老赵 36eadf383e . 5 月之前
inc . 5 月之前
res . 6 月之前
src . 5 月之前
.gitignore update 2019-09-28_15:14:22 6 月之前
Makefile . 6 月之前
README.md update 6 月之前

README.md

Making game with SDL2

Install SDL2

sudo pacman -S sdl2 sdl2_image sdl2_gfx sdl2_mixer sdl2_ttf sdl2_net

Unused Code

  // Render a red filled quad
  SDL_Rect fillRect = {window_width / 4, window_height / 4, window_width / 2,
                       window_height / 2};
  SDL_SetRenderDrawColor(renderer, 0xFF, 0x00, 0x00, 0xFF);
  SDL_RenderFillRect(renderer, &fillRect);

  // Render green outlined quad
  SDL_Rect outlineRect = {window_width / 6, window_height / 6,
                          window_width * 2 / 3, window_height * 2 / 3};
  SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF);
  SDL_RenderDrawRect(renderer, &outlineRect);

  // Draw blue horizontal line
  SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0xFF, 0xFF);
  SDL_RenderDrawLine(renderer, 0, window_height / 2, window_width,
                     window_height / 2);

  // Draw vertical line of yellow dots
  SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0x00, 0xFF);
  for (int i = 0; i < window_height; i += 4) {
    SDL_RenderDrawPoint(renderer, window_width / 2, i);
  }

  // 视窗
  SDL_Rect topLeftViewport;
  topLeftViewport.x = 50;
  topLeftViewport.y = 50;
  topLeftViewport.w = 128;
  topLeftViewport.h = 96;
  SDL_RenderSetViewport(renderer, &topLeftViewport);
  SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0x00);
  SDL_RenderCopy(renderer, texture, NULL, NULL);
  SDL_RenderSetViewport(renderer, NULL);