Fix #17, Add nuklear, Unified linux compilation
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,3 +4,6 @@
|
|||||||
[submodule "ext/glfw"]
|
[submodule "ext/glfw"]
|
||||||
path = ext/glfw
|
path = ext/glfw
|
||||||
url = https://github.com/glfw/glfw
|
url = https://github.com/glfw/glfw
|
||||||
|
[submodule "ext/nuklear"]
|
||||||
|
path = ext/nuklear
|
||||||
|
url = https://github.com/Immediate-Mode-UI/Nuklear
|
||||||
|
|||||||
17
Makefile
17
Makefile
@@ -14,7 +14,7 @@ OBJ = \
|
|||||||
CFLAGS = \
|
CFLAGS = \
|
||||||
-I./ext/cglm/include \
|
-I./ext/cglm/include \
|
||||||
-I./ext/glfw/include \
|
-I./ext/glfw/include \
|
||||||
-Wall -Wno-unused-function -std=c99 -D_GNU_SOURCE \
|
-Wall -Wno-unused-function -std=c99 -D_POSIX_C_SOURCE \
|
||||||
|
|
||||||
WAYLAND-LIB = \
|
WAYLAND-LIB = \
|
||||||
xdg-shell \
|
xdg-shell \
|
||||||
@@ -31,8 +31,7 @@ help:
|
|||||||
@echo "Para compilar el proyecto a tu sistema operativo"
|
@echo "Para compilar el proyecto a tu sistema operativo"
|
||||||
@echo "porfavor usa uno de los siguientes comandos:"
|
@echo "porfavor usa uno de los siguientes comandos:"
|
||||||
@echo " $(MAKE) windows"
|
@echo " $(MAKE) windows"
|
||||||
@echo " $(MAKE) linux-x11"
|
@echo " $(MAKE) linux"
|
||||||
@echo " $(MAKE) linux-wayland"
|
|
||||||
@echo " $(MAKE) cocoa"
|
@echo " $(MAKE) cocoa"
|
||||||
@echo "Para limpiar los archivos compilados se puede usar"
|
@echo "Para limpiar los archivos compilados se puede usar"
|
||||||
@echo " $(MAKE) clean"
|
@echo " $(MAKE) clean"
|
||||||
@@ -49,17 +48,13 @@ glfw.dll:
|
|||||||
$(CC) -fPIC -shared -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o $@ -lgdi32
|
$(CC) -fPIC -shared -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o $@ -lgdi32
|
||||||
|
|
||||||
# LINUX
|
# LINUX
|
||||||
linux-x11: $(OBJ)
|
linux: $(OBJ)
|
||||||
$(MAKE) BKN=_GLFW_X11 libglfw.so
|
|
||||||
$(CC) -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw -lm
|
|
||||||
|
|
||||||
linux-wayland: $(OBJ)
|
|
||||||
for i in $(WAYLAND-LIB); \
|
for i in $(WAYLAND-LIB); \
|
||||||
do \
|
do \
|
||||||
wayland-scanner client-header ext/glfw/deps/wayland/$$i.xml ext/glfw/deps/wayland/$$i-client-protocol.h; \
|
wayland-scanner client-header ext/glfw/deps/wayland/$$i.xml ext/glfw/deps/wayland/$$i-client-protocol.h; \
|
||||||
wayland-scanner private-code ext/glfw/deps/wayland/$$i.xml ext/glfw/deps/wayland/$$i-client-protocol-code.h; \
|
wayland-scanner private-code ext/glfw/deps/wayland/$$i.xml ext/glfw/deps/wayland/$$i-client-protocol-code.h; \
|
||||||
done
|
done
|
||||||
$(MAKE) BKN=_GLFW_WAYLAND libglfw.so
|
$(MAKE) DFLAGS="-D_GLFW_WAYLAND -D_GLFW_X11" libglfw.so
|
||||||
$(CC) -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw -lm
|
$(CC) -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw -lm
|
||||||
|
|
||||||
run-linux:
|
run-linux:
|
||||||
@@ -67,11 +62,11 @@ run-linux:
|
|||||||
|
|
||||||
# COCOA
|
# COCOA
|
||||||
cocoa: $(OBJ)
|
cocoa: $(OBJ)
|
||||||
$(MAKE) BKN=_GLFW_COCOA libglfw.so
|
$(MAKE) DFLAGS="-D_GLFW_COCOA" libglfw.so
|
||||||
$(CC) -framework OpenGL -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw
|
$(CC) -framework OpenGL -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw
|
||||||
|
|
||||||
libglfw.so:
|
libglfw.so:
|
||||||
$(CC) -fPIC -shared -D$(BKN) -D_GLFW_BUILD_DLL -Iext/glfw/deps/wayland ./ext/glfw/src/*.c -o $@
|
$(CC) -fPIC -shared $(DFLAGS)-D_GLFW_BUILD_DLL -Iext/glfw/deps/wayland ./ext/glfw/src/*.c -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm $(OBJ) $(BIN) ext/glfw/deps/wayland/*.h
|
rm $(OBJ) $(BIN) ext/glfw/deps/wayland/*.h
|
||||||
|
|||||||
11
README.md
11
README.md
@@ -18,9 +18,8 @@ Para poder compilar el proyecto hace falta lo siguiente.
|
|||||||
- `glfw`: A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input.
|
- `glfw`: A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input.
|
||||||
- `cglm`: Highly Optimized 2D / 3D Graphics Math (glm) for C.
|
- `cglm`: Highly Optimized 2D / 3D Graphics Math (glm) for C.
|
||||||
### Linux
|
### Linux
|
||||||
Para compilar `glfw` en linux hacen falta las siguientes librerías según el caso. (no incluidas)
|
Para compilar `glfw` en linux hacen falta las siguientes librerías. (no incluidas)
|
||||||
- `x11`: libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
|
- libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel libwayland-dev libxkbcommon-dev wayland-protocols
|
||||||
- `wayland`: libwayland-dev libxkbcommon-dev wayland-protocols
|
|
||||||
|
|
||||||
# Descargas
|
# Descargas
|
||||||
- [git](https://git-scm.com/downloads/win)
|
- [git](https://git-scm.com/downloads/win)
|
||||||
@@ -43,8 +42,7 @@ Los siguientes comandos sirven para compilar `manigraph` deacuerdo al sistema op
|
|||||||
|
|
||||||
```
|
```
|
||||||
make windows
|
make windows
|
||||||
make linux-x11
|
make linux
|
||||||
make linux-wayland
|
|
||||||
make cocoa
|
make cocoa
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -62,8 +60,7 @@ cc -fPIC -shared -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o glfw.dll
|
|||||||
|
|
||||||
#### Linux
|
#### Linux
|
||||||
```
|
```
|
||||||
cc -fPIC -shared -D_GLFW_X11 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o libglfw.so
|
cc -fPIC -shared -D_GLFW_X11 -D_GLFW_WAYLAND -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o libglfw.so
|
||||||
cc -fPIC -shared -D_GLFW_WAYLAND -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o libglfw.so
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Mac
|
#### Mac
|
||||||
|
|||||||
1
ext/nuklear
Submodule
1
ext/nuklear
Submodule
Submodule ext/nuklear added at 6566d9075d
@@ -25,7 +25,7 @@ void set_projection_mesh(struct projection projection)
|
|||||||
glVertexAttribPointer(3, 1, GL_FLOAT, 0, projection.m * sizeof(float),
|
glVertexAttribPointer(3, 1, GL_FLOAT, 0, projection.m * sizeof(float),
|
||||||
(float *)(projection.w * sizeof(float)));
|
(float *)(projection.w * sizeof(float)));
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->n_vbo);
|
glBindBuffer(GL_UNIFORM_BUFFER, p->n_vbo);
|
||||||
glVertexAttribPointer(4, 1, GL_FLOAT, 0, projection.m * sizeof(float),
|
glVertexAttribPointer(4, 1, GL_FLOAT, 0, projection.m * sizeof(float),
|
||||||
(float *)(projection.x * sizeof(float)));
|
(float *)(projection.x * sizeof(float)));
|
||||||
glVertexAttribPointer(5, 1, GL_FLOAT, 0, projection.m * sizeof(float),
|
glVertexAttribPointer(5, 1, GL_FLOAT, 0, projection.m * sizeof(float),
|
||||||
@@ -63,8 +63,8 @@ mesh_t create_mesh(float *d, float *n, unsigned char m)
|
|||||||
if (n)
|
if (n)
|
||||||
{
|
{
|
||||||
glGenBuffers(1, &p->n_vbo);
|
glGenBuffers(1, &p->n_vbo);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->n_vbo);
|
glBindBuffer(GL_UNIFORM_BUFFER, p->n_vbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, p->vertex * m * sizeof(float), n + 1,
|
glBufferData(GL_UNIFORM_BUFFER, p->vertex * m * sizeof(float), n + 1,
|
||||||
GL_STATIC_DRAW);
|
GL_STATIC_DRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ void destroy_texture(unsigned int texture)
|
|||||||
return glDeleteTextures(1, &texture);
|
return glDeleteTextures(1, &texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
id_t create_palette_texture(const unsigned char *colors, unsigned char n)
|
id_t create_palette_texture(const unsigned char colors[][4], unsigned char n)
|
||||||
{
|
{
|
||||||
id_t texture = __config_texture(TYPE);
|
id_t texture = __config_texture(TYPE);
|
||||||
glTexImage3D(
|
glTexImage3D(
|
||||||
|
|||||||
Reference in New Issue
Block a user