42_Scale

a small software to create and edit 42 (.yaml) scale files easily
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/42_Scale

commit fa5d31c81740366e30f20336f33fffc1fd968dcd
parent bdafb87d5900eff7bf082f11539c47030f70c9e8
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon, 25 Apr 2016 17:56:00 +0200

Add(Mac support): and a gif.

Diffstat:
A42_scale.gif | 0
MMakefile | 4++--
Minc/scale.h | 4++--
Msrcs/graphic.c | 4++--
Msrcs/helpers.c | 5+++++
5 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/42_scale.gif b/42_scale.gif Binary files differ. diff --git a/Makefile b/Makefile @@ -8,8 +8,8 @@ OBJS = $(SRCS:%.c=%.o) UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) - LIBS = -lglfw3 -framework OpenGL -lm -lGLEW - LIBS_DIR = -L ~/.brew/lib + LIBS = -lglfw3 -framework OpenGL -lm -lGLEW -lyaml + LIBS_DIR = -L ~/.brew/lib -L ./libs/libyaml/src/.libs else LIBS = -lglfw -lGL -lm -lGLU -lGLEW -lyaml LIBS_DIR = -L ./libs/libyaml/src/.libs/ diff --git a/inc/scale.h b/inc/scale.h @@ -14,8 +14,8 @@ # include <assert.h> # define ERROR(...) printf("\033[1;31mFATAL ERROR:\033[0m 42_scale must stop. \n\033[0;31m> Reason: \033[0m"); printf(__VA_ARGS__); print_trace(); _exit(1); -# define WINDOW_WIDTH 800 -# define WINDOW_HEIGHT 600 +# define WINDOW_WIDTH 2240 +# define WINDOW_HEIGHT 1200 # define MAX_INPUTS 9 enum { diff --git a/srcs/graphic.c b/srcs/graphic.c @@ -323,7 +323,7 @@ void handle_window(scale *s, struct nk_context *ctx) { int w_flag = NK_WINDOW_TITLE | NK_WINDOW_BORDER | NK_WINDOW_CLOSABLE | NK_WINDOW_SCALABLE | NK_WINDOW_MOVABLE; - if (nk_begin(ctx, &layout, "Main", nk_rect(10, 10, 600, WINDOW_HEIGHT * 1.5), w_flag)) { + if (nk_begin(ctx, &layout, "Main", nk_rect(10, 10, 600, 900), w_flag)) { nk_layout_row(ctx, NK_STATIC, 25, 2, ratio); nk_label(ctx, "Subject name", NK_TEXT_LEFT); nk_edit_string(ctx, NK_EDIT_FIELD, s->name.buf, &s->name.len, 64, nk_filter_default); @@ -359,7 +359,7 @@ void handle_window(scale *s, struct nk_context *ctx) { if (!new_section) { new_section = malloc(64); } - if (nk_begin(ctx, &layout, "Sections", nk_rect(620, 10, 600, WINDOW_HEIGHT * 1.5), w_flag)) { + if (nk_begin(ctx, &layout, "Sections", nk_rect(620, 10, 600, 900), w_flag)) { nk_layout_row(ctx, NK_STATIC, 25, 2, ratio); active = nk_edit_string(ctx, NK_EDIT_FIELD|NK_EDIT_SIG_ENTER, new_section, &ns_len, 64, nk_filter_ascii); if (nk_button_label(ctx, "Add a Section", NK_BUTTON_DEFAULT) || (active & NK_EDIT_COMMITED)) { diff --git a/srcs/helpers.c b/srcs/helpers.c @@ -9,6 +9,7 @@ void print_trace(void) { size = backtrace(array, 10); strings = backtrace_symbols(array, size); printf("\033[0;31m> \033[0mPrinting backtrace ...\n\e[37m"); +#ifndef __APPLE__ for (size_t i = 0; i < size; i++) { for (j = 0; strings[i][j] && strings[i][j] != '('; j++); if (j > f_tab) @@ -37,6 +38,10 @@ void print_trace(void) { write(1, "\n", 1); } free(strings); +#else + for (size_t i = 0; i < size; i++) + printf("%s\n", strings[i]); +#endif printf("\033[0m"); }