Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ build/libgoldie-ui.dylib
tests/triangulate_test
tests/bsp_test
tests/bbox_test
tests/collision_test
tests/wad_test
tests/walls_test
tests/player_test
triangulate_test
bsp_test
bbox_test
collision_test
wad_test
walls_test
player_test
*.o

# Build logs
Expand Down
28 changes: 24 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ endif
OBJS = $(MAPVIEW_OBJS) $(EDITOR_OBJS) $(HEXEN_OBJS)

# Targets
.PHONY: all clean test triangulate_test liborion
.PHONY: all clean test triangulate_test bbox_test bsp_test collision_test wad_test walls_test player_test liborion

all: liborion mapview

Expand All @@ -105,7 +105,7 @@ liborion: $(LIBORION)

$(LIBORION):
@echo "Building liborion via ui/Makefile..."
@$(MAKE) -C $(UI_DIR) all
@$(MAKE) -C $(UI_DIR) library

# mapview executable (main executable)
mapview: $(OBJS) $(LIBORION)
Expand Down Expand Up @@ -138,22 +138,42 @@ $(BUILD_DIR)/hexen/%.o: $(HEXEN_DIR)/%.c
$(CC) $(CFLAGS) -I. -c $< -o $@

# Test targets
test: triangulate_test bbox_test
test: triangulate_test bbox_test bsp_test collision_test wad_test walls_test player_test
@echo "=== Running all tests ==="
@./triangulate_test
@./bbox_test
@./bsp_test
@./collision_test
@./wad_test
@./walls_test
@./player_test

triangulate_test: $(TESTS_DIR)/triangulate_test.c $(MAPVIEW_DIR)/triangulate.c
$(CC) -DTEST_MODE -o $@ $^ -I. -lm

bbox_test: $(TESTS_DIR)/bbox_test.c
$(CC) -o $@ $< -I. -lm

bsp_test: $(TESTS_DIR)/bsp_test.c
$(CC) -o $@ $< -I. -lm

collision_test: $(TESTS_DIR)/collision_test.c
$(CC) -o $@ $< -I. -lm

wad_test: $(TESTS_DIR)/wad_test.c
$(CC) -o $@ $< -I. -lm

walls_test: $(TESTS_DIR)/walls_test.c
$(CC) -o $@ $< -I. -lm

player_test: $(TESTS_DIR)/player_test.c
$(CC) -o $@ $< -I. -lm

# Clean
clean:
-@if [ -f $(UI_DIR)/Makefile ]; then $(MAKE) -C $(UI_DIR) clean; fi
rm -rf $(BUILD_DIR)
-rm -f triangulate_test bbox_test doom-ed
-rm -f triangulate_test bbox_test bsp_test collision_test wad_test walls_test player_test doom-ed
-test -f mapview && rm -f mapview || true
rm -f $(MAPVIEW_DIR)/*.o $(EDITOR_DIR)/*.o $(EDITOR_DIR)/windows/*.o $(EDITOR_DIR)/windows/inspector/*.o
rm -f $(HEXEN_DIR)/*.o $(DOOM_DIR)/*.o
4 changes: 2 additions & 2 deletions editor/windows/sprite.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ result_t win_sprite(window_t *win, uint32_t msg, uint32_t wparam, void *lparam)
switch (msg) {
case evPaint:
fill_rect(g_ui_runtime.focused == win ? get_sys_color(brFocusRing) : get_sys_color(brWindowBg), R(win->frame.x-2, win->frame.y-2, win->frame.w+4, win->frame.h+4));
draw_button(&win->frame, 1, 1, true);
draw_button(win->frame, 1, 1, true);
if (!*win->title) return false;
if ((spr = find_sprite(win->title))) {
rect_t r = fit_sprite(spr, &win->frame);
draw_rect(spr->texture, &r);
draw_rect(spr->texture, r);
} else if ((tex = get_flat_texture(win->title))||(tex = get_texture(win->title))) {
float scale = fminf(1, fminf(((float)win->frame.w) / tex->width,
((float)win->frame.h) / tex->height));
Expand Down
2 changes: 1 addition & 1 deletion editor/windows/things.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ result_t win_things(window_t *win, uint32_t msg, uint32_t wparam, void *lparam)
uint16_t y = (j / n) * (THING_SIZE+THING_LABEL_HEIGHT);
uint16_t tx = x + (THING_SIZE-strwidth(ed_things[i].sprite))/2;
rect_t r = fit_sprite(spr, &(rect_t){ x, y, THING_SIZE, THING_SIZE });
draw_rect(spr->texture, &r);
draw_rect(spr->texture, r);
draw_text_small(ed_things[i].sprite, tx, y + THING_SIZE+4, get_sys_color(brTextNormal));
j++;
}
Expand Down
8 changes: 4 additions & 4 deletions mapview/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ int send_message(window_t *win, uint32_t msg, uint32_t wparam, void *lparam);
void post_message(window_t *win, uint32_t msg, uint32_t wparam, void *lparam);
void invalidate_window(window_t *win);
void set_window_item_text(window_t *win, uint32_t id, const char *fmt, ...);
Comment thread
corepunch marked this conversation as resolved.
int window_title_bar_y(window_t const *win);
window_t *get_window_item(window_t const *win, uint32_t id);

void track_mouse(window_t *win);
void set_capture(window_t *win);
void set_focus(window_t* win);
Expand Down Expand Up @@ -433,9 +433,9 @@ void draw_bsp(map_data_t const *map, viewdef_t const *viewdef);
void update_player_position_with_sliding(map_data_t const *map, player_t *player,
float move_x, float move_y);

void fill_rect(uint32_t color, rect_t const *r);
void draw_rect(int tex, rect_t const *r);
void draw_rect_ex(int tex, rect_t const *r, int type, float alpha);
void fill_rect(uint32_t color, rect_t r);
void draw_rect(int tex, rect_t r);
void draw_rect_ex(int tex, rect_t r, int type, float alpha);
void draw_icon8(int icon, int x, int y, uint32_t col);
void draw_icon16(int icon, int x, int y, uint32_t col);
void draw_palette(map_data_t const *map);
Expand Down
2 changes: 1 addition & 1 deletion mapview/wi_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void goto_intermisson(void) {

void handle_intermission_input(float delta_time) {
ui_event_t event;
while (axPollEvent(&event)) {
while (get_message(&event)) {
if (event.message == kEventWindowClosed) {
g_ui_runtime.running = false;
}
Expand Down
Loading
Loading