Skip to content

Commit

Permalink
Move & rename utils/ui -> utils/platform/sdl
Browse files Browse the repository at this point in the history
Removed a useless function as well.
  • Loading branch information
vkoskiv committed Nov 4, 2023
1 parent 99407a3 commit f09580b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 31 deletions.
6 changes: 4 additions & 2 deletions src/api/c-ray.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "../utils/platform/terminal.h"
#include "../utils/assert.h"
#include "../datatypes/image/texture.h"
#include "../utils/ui.h"
#include "../utils/timer.h"
#include "../utils/args.h"
#include "../utils/encoders/encoder.h"
Expand Down Expand Up @@ -221,7 +220,10 @@ void cr_start_renderer(struct renderer *r) {
}
timer_start(&r->state.timer);
currentImage = renderFrame(r);
printDuration(timer_get_ms(r->state.timer));
long ms = timer_get_ms(r->state.timer);
logr(info, "Finished render in ");
printSmartTime(ms);
logr(plain, " \n");
}

void cr_start_render_worker() {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
#include "../datatypes/scene.h"
#include "pathtrace.h"
#include "../utils/logging.h"
#include "../utils/ui.h"
#include "../datatypes/tile.h"
#include "../utils/timer.h"
#include "../datatypes/image/texture.h"
#include "../datatypes/mesh.h"
#include "../datatypes/sphere.h"
#include "../utils/platform/thread.h"
#include "../utils/platform/mutex.h"
#include "../utils/platform/sdl.h"
#include "samplers/sampler.h"
#include "../utils/args.h"
#include "../utils/platform/capabilities.h"
Expand Down
46 changes: 20 additions & 26 deletions src/utils/ui.c → src/utils/platform/sdl.c
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
//
// ui.c
// C-ray
// sdl.c
// c-ray
//
// Created by Valtteri Koskivuori on 19/02/2017.
// Copyright © 2017-2021 Valtteri Koskivuori. All rights reserved.
// Copyright © 2017-2023 Valtteri Koskivuori. All rights reserved.
//

#include "../includes.h"
#include "ui.h"
#include "../../includes.h"
#include "sdl.h"

#include "../datatypes/image/imagefile.h"
#include "../renderer/renderer.h"
#include "logging.h"
#include "../datatypes/tile.h"
#include "../datatypes/image/texture.h"
#include "../datatypes/color.h"
#include "platform/thread.h"
#include "platform/signal.h"
#include "assert.h"
#include "logo.h"
#include "loaders/textureloader.h"
#include "args.h"
#include "platform/dyn.h"
#include "../../datatypes/image/imagefile.h"
#include "../../renderer/renderer.h"
#include "../../datatypes/tile.h"
#include "../../datatypes/image/texture.h"
#include "../../datatypes/color.h"
#include "../logging.h"
#include "../assert.h"
#include "../logo.h"
#include "../loaders/textureloader.h"
#include "../args.h"
#include "thread.h"
#include "signal.h"
#include "dyn.h"

#include "../vendored/SDL2/SDL_render.h"
#include "../vendored/SDL2/SDL_events.h"
#include "../../vendored/SDL2/SDL_render.h"
#include "../../vendored/SDL2/SDL_events.h"

struct sdl_syms {
void *lib;
Expand Down Expand Up @@ -269,12 +269,6 @@ void win_destroy(struct sdl_window *w) {
w = NULL;
}

void printDuration(uint64_t ms) {
logr(info, "Finished render in ");
printSmartTime(ms);
logr(plain, " \n");
}

void win_check_keyboard(struct sdl_window *sdl, struct renderer *r) {
if (!sdl) return;
SDL_Event event;
Expand Down
2 changes: 0 additions & 2 deletions src/utils/ui.h → src/utils/platform/sdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ struct sdl_window *win_try_init(struct sdl_prefs *prefs, int width, int height);
void win_update(struct sdl_window *w, struct renderer *r, struct texture *t);
void win_check_keyboard(struct sdl_window *w, struct renderer *r);
void win_destroy(struct sdl_window *);

void printDuration(uint64_t ms);

0 comments on commit f09580b

Please sign in to comment.