Yesterday marked the first day of Devember that I did not find the time to work on my mandatory games list and also didn’t write a devlog. I wasn’t completly absent of developing however, since I set up everything for my first Cardboard App for a university project.
Today wasn’t that much better time-wise but I did get something done. First of all I ran into problems again. Apparently SDL 2 doesn’t work to well with Visual Studio 2015. But after some searching on the web I found a solution and could start learning. Since the Tetris game consistend mainly of copy&paste snippets from the main tutorial and some SDL tutorials + some modifications by me, I didn’t really know how to work with SDL. Therefore what I did so far is very basic: I opened a window and displayed the player’s spaceship on it. After 4 seconds SDL quits and the “game” closes.
I know it’s not much but I’m quite happy with it. After 7 days I’m quite conflicted about Devember. On the one hand it’s nice to have some time each day commited to gamedev. On the other hand I realized that I need more than one hour to accomplish something. If I have the time I spent more than one hour with the project because after the 60 minutes mark I’m starting to really get into it and get things done. Unfortunately my December has been really busy so far and sometimes 60 minutes is all I can afford to spend on gamedev. Maybe I’ll have to repeat the idea of at least one hour of coding in another month.
However, the code so far:
#include <SDL.h> #include <stdio.h> int main(int argc, char* args[]) { SDL_Window* window = NULL; SDL_Surface* surface = NULL; SDL_Surface* playerShip = NULL; //initialize SDL if (SDL_Init(SDL_INIT_VIDEO) < 0) { printf("There was an error initializing the SDL"); return 0; } //create a window //CreateWindow("Title", xPos, yPos, xSize, ySize, Flag) window = SDL_CreateWindow("Space Invaders", 50, 50, 500, 400, SDL_WINDOW_SHOWN); if (window == NULL) { printf("There was an error creating the window"); return 0; } printf("window was created"); //surface added to window surface = SDL_GetWindowSurface(window); //load image playerShip = SDL_LoadBMP("player.bmp"); if (playerShip == NULL) { printf("There was an error loading the image"); return 0; } printf("image loaded"); //(what, where, destination, where) SDL_BlitSurface(playerShip, NULL, surface, NULL); //update window SDL_UpdateWindowSurface(window); SDL_Delay(4000); //ms SDL_DestroyWindow(window); SDL_Quit(); return 0; }