diff --git a/LibGui/Makefile b/LibGui/Makefile new file mode 100644 index 0000000..4b35168 --- /dev/null +++ b/LibGui/Makefile @@ -0,0 +1,34 @@ +CC=gcc +CFLAGS=-Wall -Werror -pedantic -fpic -g -std=c89 + + +LIBSDIR=-L/usr/lib -L../Libs +INCLUDEDIR=-I/usr/include -I. -I../LibAutomaton + +#Library variables +LIBTARGET=libGui.so +LIBSOURCE=pixel +LIBSOURCECFILE=$(LIBSOURCE:=.c) +LIBSOURCEOFILE=$(LIBSOURCE:=.o) + +DEPENDENCELIST=libAutomaton.so +DEPENDENCENAMELIST=Automaton + +EXTLIBS=`sdl2-config --cflags --libs` + +#Generating the library binary +$(LIBTARGET): $(LIBSOURCEOFILE) + @echo "\n Generating the library binary" + $(CC) $(CFLAGS) $(LIBSDIR) $(EXTLIBS) -l$(DEPENDENCENAMELIST) -shared $(LIBSOURCEOFILE) -o ../Libs/$(LIBTARGET) + +#Generating object files +.c.o: + @echo "\n Generating " $@ " from " $< + $(CC) $(CFLAGS) $(INCLUDEDIR) -c -o $@ $< + +#Cleaning +clean: + @echo "\n Cleaning" + rm -rf *.o *.exe *.so + + diff --git a/LibGui/pixel.c b/LibGui/pixel.c new file mode 100644 index 0000000..3320610 --- /dev/null +++ b/LibGui/pixel.c @@ -0,0 +1,19 @@ +/* +* @Author: klmp200 +* @Date: 2016-12-27 19:59:21 +* @Last Modified by: klmp200 +* @Last Modified time: 2016-12-27 20:09:56 +*/ + +#include +#include +#include +#include +#include + +void SDL_test(){ + PIXEL test; + Matrix gg = CreateMatrix(); + SetCellValue(gg, 1, 1, true); + test.color = 1; +} diff --git a/LibGui/pixel.h b/LibGui/pixel.h new file mode 100644 index 0000000..84696b0 --- /dev/null +++ b/LibGui/pixel.h @@ -0,0 +1,13 @@ +#ifndef PIXEL_H_INCLUDED +#define PIXEL_H_INCLUDED + +#include + +typedef struct { + SDL_Rect position; + Uint8 color; +} PIXEL; + +void SDL_test(); + +#endif diff --git a/Makefile b/Makefile index 927f498..69be545 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ CFLAGS=-Wall -Werror -pedantic -fpic -g -std=c89 EXTLIBS=`sdl2-config --cflags --libs` LIBSDIR=-L/usr/lib -L./Libs -INCLUDEDIR=-I/usr/include -I. -I./LibAutomaton +INCLUDEDIR=-I/usr/include -I. -I./LibAutomaton -I./LibGui #Exe test variables TARGET=main @@ -17,8 +17,9 @@ SOURCE=main SOURCECFILE=$(SOURCE:=.c) SOURCEOFILE=$(SOURCE:=.o) -DEPENDENCELIST=libAutomaton.so -DEPENDENCENAMELIST=Automaton +DEPENDENCELIST=libAutomaton.so libGui.so +DEPENDENCENAMEONE=Automaton +DEPENDENCENAMETWO=Gui all: $(TARGET) @@ -26,12 +27,12 @@ all: $(TARGET) $(TARGET): $(SOURCEOFILE) $(DEPENDENCELIST) lib @echo "\n Generating the " $(TARGET) " binary" mkdir -p build - $(CC) $(SOURCEOFILE) $(LIBSDIR) $(EXTLIBS) -l$(DEPENDENCENAMELIST) -o ./build/$(TARGET) + $(CC) $(SOURCEOFILE) $(LIBSDIR) $(EXTLIBS) -l$(DEPENDENCENAMEONE) -l$(DEPENDENCENAMETWO) -o ./build/$(TARGET) #Generating the library binary lib: @echo "\n Generating the automaton library binary" - # $(MAKE) -C LibCell + $(MAKE) -C LibGui $(DEPENDENCELIST): @echo "\n Generating the automaton library binary" diff --git a/main.c b/main.c index 9dd06a5..b3b0dde 100644 --- a/main.c +++ b/main.c @@ -9,6 +9,7 @@ #include #include #include +#include int main(int argc, char **argv){ int Rule = 256;