This commit is contained in:
parent
df21a95933
commit
c2485979aa
2
error.c
2
error.c
|
@ -6,7 +6,7 @@
|
|||
#include <Windows.h>
|
||||
static void showError(const char *er) {
|
||||
int ret = MessageBoxA(NULL,er,"Quit the program?",MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2|MB_APPLMODAL);
|
||||
if(ret = IDYES) {
|
||||
if(ret == IDYES) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
22
main.c
22
main.c
|
@ -6,15 +6,15 @@
|
|||
|
||||
SDL_Window* window;
|
||||
SDL_Renderer* renderer;
|
||||
SDL_Texture* lettuce_tex;
|
||||
SDL_Texture* mascot_tex;
|
||||
int main(int argc, char* argv[]) {
|
||||
SDL_Surface* lettuce_sur;
|
||||
SDL_Surface* mascot_sur=NULL;
|
||||
reportError("startup purrforce?");
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0) {
|
||||
reportError("Error SDL2 Initialization : %s",SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
window = SDL_CreateWindow("First program", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, SDL_WINDOW_OPENGL);
|
||||
window = SDL_CreateWindow("First program", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_OPENGL);
|
||||
if (window == NULL) {
|
||||
reportError("Error window creation");
|
||||
return 3;
|
||||
|
@ -24,17 +24,17 @@ int main(int argc, char* argv[]) {
|
|||
reportError("Error renderer creation");
|
||||
return 4;
|
||||
}
|
||||
lettuce_sur = IMG_Load("lettuce.png");
|
||||
if (lettuce_sur == NULL) {
|
||||
//mascot_sur = IMG_Load("mascot.png");
|
||||
if (mascot_sur == NULL) {
|
||||
reportError("Error loading image: %s",IMG_GetError());
|
||||
return 5;
|
||||
}
|
||||
lettuce_tex = SDL_CreateTextureFromSurface(renderer, lettuce_sur);
|
||||
if (lettuce_tex == NULL) {
|
||||
mascot_tex = SDL_CreateTextureFromSurface(renderer, mascot_sur);
|
||||
if (mascot_tex == NULL) {
|
||||
reportError("Error creating texture");
|
||||
return 6;
|
||||
}
|
||||
SDL_FreeSurface(lettuce_sur);
|
||||
SDL_FreeSurface(mascot_sur);
|
||||
while (1) {
|
||||
SDL_Event e;
|
||||
if (SDL_WaitEvent(&e)) {
|
||||
|
@ -43,13 +43,13 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
}
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderCopy(renderer, lettuce_tex, NULL, NULL);
|
||||
SDL_RenderCopy(renderer, mascot_tex, NULL, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
SDL_DestroyTexture(lettuce_tex);
|
||||
SDL_DestroyTexture(mascot_tex);
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
IMG_Quit();
|
||||
// IMG_Quit();
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
|
|
30
sync2git.bat
30
sync2git.bat
|
@ -1,11 +1,19 @@
|
|||
copy /B /Y api.h D:\dev\db\purrforce\
|
||||
copy /B /Y error.c D:\dev\db\purrforce\
|
||||
copy /B /Y ls.bat D:\dev\db\purrforce\
|
||||
copy /B /Y main.c D:\dev\db\purrforce\
|
||||
copy /B /Y make.bat D:\dev\db\purrforce\
|
||||
copy /B /Y Makefile D:\dev\db\purrforce\
|
||||
copy /B /Y pull_fromgit.bat D:\dev\db\purrforce\
|
||||
copy /B /Y readme.md D:\dev\db\purrforce\
|
||||
copy /B /Y rm.bat D:\dev\db\purrforce\
|
||||
copy /B /Y sync2git.bat D:\dev\db\purrforce\
|
||||
copy /B /Y touch.bat D:\dev\db\purrforce\
|
||||
set GITDIR=D:\dev\db\purrforce\
|
||||
copy /B /Y api.h %GITDIR%
|
||||
copy /B /Y error.c %GITDIR%
|
||||
copy /B /Y ls.bat %GITDIR%
|
||||
copy /B /Y main.c %GITDIR%
|
||||
copy /B /Y make.bat %GITDIR%
|
||||
copy /B /Y Makefile %GITDIR%
|
||||
copy /B /Y pull_fromgit.bat %GITDIR%
|
||||
copy /B /Y readme.md %GITDIR%
|
||||
copy /B /Y rm.bat %GITDIR%
|
||||
copy /B /Y sync2git.bat %GITDIR%
|
||||
copy /B /Y touch.bat %GITDIR%
|
||||
set RETFOL=%~dp0
|
||||
cd %GITDIR%
|
||||
git add -u
|
||||
git add .
|
||||
git commit -m ok
|
||||
git push
|
||||
cd %RETFOL%
|
||||
|
|
Loading…
Reference in New Issue