Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
First upload of current code.
  • Loading branch information
nevat committed Aug 15, 2013
0 parents commit 6d5a1e0
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 0 deletions.
18 changes: 18 additions & 0 deletions abbaye.desktop
@@ -0,0 +1,18 @@

[Desktop Entry]
Name=Abbaye des Morts
Name[ca]=Abbaye des Morts
Name[en_GB]=Abbaye des Morts
Name[es]=Abbaye des Morts
Comment=Indie platform game by Locomalito
Comment[ca]=Joc indie de plataformes de Locomalito
Comment[en_GB]=Indie platform game by Locomalito
Comment[es]=Juego indie de plataformas de Locomalito
Exec=abbaye
Icon=abbaye
Terminal=false
Type=Application
Categories=Game;ActionGame;
StartupNotify=false
Version=1.0
X-Desktop-File-Install-Version=0.19
Binary file added abbaye.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/intro.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/intromd.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/tiles.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions src/main.c
@@ -0,0 +1,44 @@
/* Abbaye des Morts */
/* Version 2.0 */

/* (c) 2010 - Locomalito & Gryzor87 */
/* 2013 - David "Nevat" Lara */

/* GPL v3 license */

main () {

uint exit = 0;
uint state = 0; /* 0-intro,1-introduction */
uint grapset = 0; /* 0-8bits, 1-16bits */

/* Creating window */
SDL_Window *screen = SDL_CreateWindow("Abbaye des Morts v2.0",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,512,384,SDL_WINDOW_OPENGL);
/* Renderer (with VSync, nice !) */
SDL_Renderer *renderer = SDL_CreateRenderer(screen, -1, SDL_RENDERER_PRESENTVSYNC);
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); // make the scaled rendering look smoother.
SDL_RenderSetLogicalSize(renderer, 256, 192);

while (exit != 1) {
switch (state) {
case 0: startscreen(screen,renderer,&state,&grapset);
break;
case 1: exit = 1;
break;
}
}

/* Cleaning */
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(screen);

/* Exiting normally */
return 0;

}

void history(SDL_Renderer *renderer,uint *state,uint *grapset) {

uint exit = 0;

}
6 changes: 6 additions & 0 deletions src/main.h
@@ -0,0 +1,6 @@
/* main.h */

# include <stdio.h>
# include <stdlib.h>
# include "SDL2/SDL.h"
# include "SDL2/SDL_image.h"
62 changes: 62 additions & 0 deletions src/startscreen.c
@@ -0,0 +1,62 @@
/* startscreen.c */

# include "startscreen.h";

void startscreen(SDL_Window *screen,SDL_Renderer *renderer,uint *state,uint *grapset) {

int exit = 0;

SDL_Rect srcintro = {0,0,256,192};
SDL_Rect desintro = {0,0,256,192};

SDL_Event keyp;

/* Loading PNG */
SDL_Texture *intro = IMG_LoadTexture(renderer,"../graphics/intro.png");
SDL_Texture *intromd = IMG_LoadTexture(renderer,"../graphics/intromd.png");

while (exit != 1) {

/* Cleaning the renderer */
SDL_RenderClear(renderer);

/* Put image on renderer */
if (*grapset == 0)
SDL_RenderCopy(renderer, intro, &srcintro, &desintro);
else
SDL_RenderCopy(renderer, intromd, &srcintro, &desintro);

/* Flip ! */
SDL_RenderPresent(renderer);

/* Check keyboard */
if ( SDL_PollEvent(&keyp) ) {
if (keyp.type == SDL_KEYDOWN) { /* Key pressed */
if (keyp.key.keysym.sym == SDLK_c) { /* Change graphic set */
if (*grapset == 0)
*grapset = 1;
else
*grapset = 0;
}
if (keyp.key.keysym.sym == SDLK_i) { /* Show instructions */
if (srcintro.y == 0)
srcintro.y = 192;
else
srcintro.y = 0;
}
if (keyp.key.keysym.sym == SDLK_f) /* Switch to fullscreen */
SDL_SetWindowFullscreen(screen,SDL_WINDOW_FULLSCREEN);
if (keyp.key.keysym.sym == SDLK_SPACE) { /* Start game */
*state = 1;
exit = 1;
}
}
}

}

/* Cleaning */
SDL_DestroyTexture(intro);
SDL_DestroyTexture(intromd);

}
6 changes: 6 additions & 0 deletions src/startscreen.h
@@ -0,0 +1,6 @@
/* startscreen.h */

# include <stdio.h>
# include <stdlib.h>
# include "SDL2/SDL.h"
# include "SDL2/SDL_image.h"

0 comments on commit 6d5a1e0

Please sign in to comment.