diff --git a/Makefile b/Makefile index c95f626..dc2ef26 100644 --- a/Makefile +++ b/Makefile @@ -9,11 +9,16 @@ CAT=type # \ SEVENZ="C:\Program Files\7-Zip\7z.exe" -y # \ SDL2LIB=SDL2.lib # \ SDL2IMGLIB=SDL2_image.lib # \ -CCOBJ=cl /c /Iinclude # \ +CCOBJ=cl /nologo /c /Iinclude # \ OBJOUT=/Fo#\ EXEOUT=/Fe#\ -CCEXE=cl /Iinclude # \ -LDFLAGS=SDL2main.lib SDL2.lib shell32.lib /link /subsystem:windows # \ +CCEXE=cl /nologo /Iinclude # \ +#LDFLAGS=SDL2main.lib SDL2.lib shell32.lib /link /subsystem:windows # \ +LDFLAGS= kernel32.lib user32.lib shell32.lib /link /subsystem:console # \ +RUNPREFIX= # \ +USE_TRAY=-DTRAY_WINAPI=1 # \ +LINK_TRAY= # \ +LINK_SDL= SDL2.lib #\ !else # Make code here MV=mv -f @@ -30,6 +35,10 @@ OBJOUT=-o EXEOUT=-o CCEXE=gcc -Iinclude LDFLAGS= +RUNPREFIX=./ +USE_TRAY=-DTRAY_APPINDICATOR=1 $(shell pkg-config --cflags appindicator3-0.1) +LINK_TRAY=$(shell pkg-config --libs appindicator3-0.1) +LINK_SDL= SDL2.lib # \ !endif @@ -83,6 +92,10 @@ clean: veryclean:reallyclean reallyclean: clean -@$(RM) purforce.exe + -@$(RM) tray.exe + -@$(RM) icon.ico + -@$(RM) pf.ico + -@$(RM) pf.png -@$(RMDIR) build distclean: reallyclean -@$(RM) SDL2.a @@ -96,19 +109,29 @@ distclean: reallyclean PUR_OBJS= \ build$(PS)main.obj \ -build$(PS)error.obj +build$(PS)error.obj \ +build$(PS)stats.obj \ +build$(PS)systray.obj build$(PS)main.obj: build Makefile main.c api.h include$(PS)SDL.h include$(PS)SDL_image.h $(CCOBJ) main.c $(OBJOUT)$@ +build$(PS)stats.obj: build Makefile stats.c api.h include$(PS)SDL.h include$(PS)SDL_image.h + $(CCOBJ) stats.c $(OBJOUT)$@ build$(PS)error.obj: build Makefile api.h error.c $(CCOBJ) error.c $(OBJOUT)$@ +build$(PS)systray.obj: build pf.ico pf.png api.h tray$(PS)tray.h + $(CCOBJ) systray.c $(OBJOUT)$@ build: mkdir build - +pf.ico: images$(PS)pf.ico + $(CP) images$(PS)pf.ico $@ +pf.png: images$(PS)pf.png + $(CP) images$(PS)pf.png $@ purforce: purforce.exe + $(RUNPREFIX)purforce.exe purforce.exe: $(PUR_OBJS) $(SDL2LIB) $(SDL2IMGLIB) Makefile - $(CCEXE) $(PUR_OBJS) $(SDL2IMGLIB) $(EXEOUT)$@ $(LDFLAGS) + $(CCEXE) $(PUR_OBJS) $(SDL2IMGLIB) $(EXEOUT)$@ $(LINK_SDL) $(LDFLAGS) sdl2dev.zip: $(CP) ..\..\assets\windows\SDL2-devel-2.30.0-VC.zip $@ @@ -142,4 +165,13 @@ SDL2.lib: sdl2dev.zip SDL2.a: sudo apt-get install sdl2-dev ln -s /user/local/lib/sdl2/sdl2.so ./SDL2.a - touch SDL2.a \ No newline at end of file + touch SDL2.a + +build$(PS)trayxmpl.obj: build tray$(PS)example.c tray$(PS)tray.h + $(CCOBJ) $(USE_TRAY) tray$(PS)example.c $(OBJOUT)$@ +icon.ico: tray$(PS)icon.ico + $(CP) tray$(PS)icon.ico $@ +tray.exe: build$(PS)trayxmpl.obj icon.ico + $(CCEXE) $(USE_TRAY) build$(PS)trayxmpl.obj $(EXEOUT)$@ $(LINK_TRAY) $(LDFLAGS) +tray: tray.exe + $(RUNPREFIX)tray.exe diff --git a/api.h b/api.h index b47010b..136c3cc 100644 --- a/api.h +++ b/api.h @@ -3,5 +3,6 @@ #include void reportError(const char *fmt,...); - +enum ps { ps_startup,ps_shutdown}; +void print_stats(enum ps ps); #endif//api_h diff --git a/main.c b/main.c index 93806e7..1b251f6 100644 --- a/main.c +++ b/main.c @@ -1,13 +1,38 @@ #include + +#define SDL_MAIN_HANDLED #include #include #include "api.h" +SDL_Window * purrwin; +void purrer(void) { + SDL_Init(SDL_INIT_TIMER|SDL_INIT_EVENTS|SDL_INIT_VIDEO); + purrwin = SDL_CreateWindow("PurrForce :3", + 100, 100, 320, + 360, SDL_WINDOW_BORDERLESS|SDL_WINDOW_ALWAYS_ON_TOP|SDL_WINDOW_SHOWN); + if(purrwin == NULL) { + puts(SDL_GetError()); + } else { + SDL_DestroyWindow(purrwin); + } + SDL_Quit(); +} +int main(int argc,char**argv){ + puts("hello world"); + SDL_SetMainReady(); + print_stats(ps_startup); + purrer(); + print_stats(ps_shutdown); + return 0; +} + +/* SDL_Window* window; SDL_Renderer* renderer; SDL_Texture* mascot_tex; -int main(int argc, char* argv[]) { +int zmain(int argc, char* argv[]) { SDL_Surface* mascot_sur=NULL; reportError("startup purrforce?"); if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0) { @@ -54,3 +79,4 @@ int main(int argc, char* argv[]) { return 0; } +*/ diff --git a/make.bat b/make.bat index 75f5b32..8428b3b 100644 --- a/make.bat +++ b/make.bat @@ -1 +1 @@ -nmake %* \ No newline at end of file +nmake /NOLOGO %* \ No newline at end of file