]> git.mcshandy.xyz Git - picker/commitdiff
Removed some silly old abstraction macros
authorrandy <randy@mcshandy.xyz>
Sat, 23 Sep 2023 16:27:15 +0000 (11:27 -0500)
committerrandy <randy@mcshandy.xyz>
Sat, 23 Sep 2023 16:27:15 +0000 (11:27 -0500)
project.vim
source/main.c
source/rendering.c
source/rendering.h
source/structs.h

index 9960a5c1aaaa1c7947a6484eb920f76876f06358..8ec80d4dacaa19fa425dc61eb21f7427daf0410b 100644 (file)
@@ -1,5 +1,5 @@
 let prj_base = expand('%:p:h')
-let build = prj_base . '/bin/picker'
+let build = './bin/picker'
 let run_build  = "!" . build . " -nop"
 
 nmap \m :wa \| :make! picker \| execute run_build<CR>
@@ -24,5 +24,4 @@ function! s:ide()
 endfunction
 
 let $src=prj_base.'/source'
-let $sdl=$src.'/source/sdl'
 let $bin=prj_base.'/bin'
index ecb2093fb8832827e434f5e81d2c34e4108c1f2c..b63e25e0d0769187d7f211e5ab0dac150dfbe05d 100644 (file)
@@ -17,22 +17,22 @@ int init()
        signal(SIGTERM, killterm_handler);
 
        float scale = 1.0f;
-       runtime.layout.window = (Rect){.x = 0.0f, .y = 0.0f, .w = scale*512.0f, .h = scale*512.0f};
+       runtime.layout.window = (SDL_FRect){.x = 0.0f, .y = 0.0f, .w = scale*512.0f, .h = scale*512.0f};
 
        // satisfying rel.[xy]*2 == .[wh] centers axis in parent container
-       runtime.layout.rgb_square.rel = (Rect){.x = 0.05, .y = 0.05, .w = 0.5, .h = 0.5};
-       runtime.layout.hue_slider.rel = (Rect){.x = 0.70, .y = 0.05, .w = .08, .h = 0.5};
-       runtime.layout.final_sample.rel = (Rect){.x = 0.05, .y = .65, .w = 0.20, .h = 0.20};
-       runtime.layout.info_container.rel = (Rect){.x = 0.05, .y = .65, .w = .9, .h = .30};
-       runtime.layout.info_boxes.rel = (Rect){.x = .25, .y = 0.00, .w = 0.75, .h = 1.00};
-       runtime.layout.rgb_info.rel = (Rect){.x = 0.00, .y = 0.00, .w = 1.00, .h = 0.50};
-       runtime.layout.red.rel = (Rect){.x = 0.00, .y = 0.00, .w = 0.30, .h = 1.00};
-       runtime.layout.green.rel = (Rect){.x = 0.35, .y = 0.00, .w = 0.30, .h = 1.00};
-       runtime.layout.blue.rel = (Rect){.x = 0.70, .y = 0.00, .w = 0.30, .h = 1.00};
-       runtime.layout.hsl_info.rel = (Rect){.x = 0.00, .y = 0.50, .w = 1.00, .h = 0.50};
-       runtime.layout.hue.rel = (Rect){.x = 0.00, .y = 0.00, .w = 0.30, .h = 1.00};
-       runtime.layout.saturation.rel = (Rect){.x = 0.35, .y = 0.00, .w = 0.30, .h = 1.00};
-       runtime.layout.luminence.rel = (Rect){.x = 0.70, .y = 0.00, .w = 0.30, .h = 1.00};
+       runtime.layout.rgb_square.rel = (SDL_FRect){.x = 0.05, .y = 0.05, .w = 0.5, .h = 0.5};
+       runtime.layout.hue_slider.rel = (SDL_FRect){.x = 0.70, .y = 0.05, .w = .08, .h = 0.5};
+       runtime.layout.final_sample.rel = (SDL_FRect){.x = 0.05, .y = .65, .w = 0.20, .h = 0.20};
+       runtime.layout.info_container.rel = (SDL_FRect){.x = 0.05, .y = .65, .w = .9, .h = .30};
+       runtime.layout.info_boxes.rel = (SDL_FRect){.x = .25, .y = 0.00, .w = 0.75, .h = 1.00};
+       runtime.layout.rgb_info.rel = (SDL_FRect){.x = 0.00, .y = 0.00, .w = 1.00, .h = 0.50};
+       runtime.layout.red.rel = (SDL_FRect){.x = 0.00, .y = 0.00, .w = 0.30, .h = 1.00};
+       runtime.layout.green.rel = (SDL_FRect){.x = 0.35, .y = 0.00, .w = 0.30, .h = 1.00};
+       runtime.layout.blue.rel = (SDL_FRect){.x = 0.70, .y = 0.00, .w = 0.30, .h = 1.00};
+       runtime.layout.hsl_info.rel = (SDL_FRect){.x = 0.00, .y = 0.50, .w = 1.00, .h = 0.50};
+       runtime.layout.hue.rel = (SDL_FRect){.x = 0.00, .y = 0.00, .w = 0.30, .h = 1.00};
+       runtime.layout.saturation.rel = (SDL_FRect){.x = 0.35, .y = 0.00, .w = 0.30, .h = 1.00};
+       runtime.layout.luminence.rel = (SDL_FRect){.x = 0.70, .y = 0.00, .w = 0.30, .h = 1.00};
 
        runtime.active_hsl = (HSL_Color){.h = 0, .s = 100, .l = 50};
        runtime.active_rgb = hsl_to_rgb(runtime.active_hsl);
index ac75174bbffb8ade8a2fc7f0d9d176773d44df8f..a5dc9899961acb978a29f68c438197ceacb94534 100644 (file)
@@ -13,14 +13,11 @@ SDL_Color white = {255, 255, 255, 255};
 SDL_Color magenta = {255, 0, 255, 255};
 
 sdl_group mgr;
-const int keypress_delta = 4;
 
 int32_t init_renderer(runtime_info* runtime)
 {
-       //load_config(argv[1], gs);
-
        SDL_SetMainReady();
-       if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER))
+       if (SDL_Init(SDL_INIT_VIDEO))
        {
                fprintf(stderr, "SDL initialization failed\n");
                exit(__LINE__);
@@ -208,7 +205,7 @@ int32_t render_vertical_hue_spectrum(runtime_info* runtime, SDL_FRect* container
 int32_t render_container(runtime_info* runtime, SDL_FRect* parent, Layout_Rect* child, SDL_Color color)
 {
        SDL_SetRenderDrawColor(mgr.rend, unroll_sdl_color(color));
-       child->real = fr_marruntimen_adjust(*parent, child->rel);
+       child->real = fr_margin_adjust(*parent, child->rel);
 
        return 0;
 }
@@ -307,7 +304,7 @@ SDL_FRect fr_mult(const SDL_FRect left, const SDL_FRect right)
 }
 
 // Math out placement for a relative rect onto a concrete parent
-SDL_FRect fr_marruntimen_adjust(const SDL_FRect parent, const Relative_Rect child)
+SDL_FRect fr_margin_adjust(const SDL_FRect parent, const Relative_Rect child)
 {
        return
        (SDL_FRect){
index 839499305f5d4be2942405e40a4810dd3e51251f..64ebe1c268d6f6c8f439ad26541021cdefe293f9 100644 (file)
@@ -21,7 +21,7 @@ int32_t render_container(runtime_info* runtime, SDL_FRect* parent, Layout_Rect*
 SDL_FRect fr_add(const SDL_FRect left, const SDL_FRect right);
 SDL_FRect fr_subtract(const SDL_FRect left, const SDL_FRect right);
 SDL_FRect fr_mult(const SDL_FRect left, const SDL_FRect right);
-SDL_FRect fr_marruntimen_adjust(const SDL_FRect parent, const Relative_Rect child);
+SDL_FRect fr_margin_adjust(const SDL_FRect parent, const Relative_Rect child);
 SDL_Color hsl_to_rgb (const HSL_Color hsl);
 SDL_Color wikipedia_hsl_to_rgb (const HSL_Color hsl);
 #endif // SDL_Utils__
index dc476cf438a1f819b83e6f41df8eccc70fdec6d5..ab712b228112e3dc3fd84d239627e9c04b576e0c 100644 (file)
@@ -3,11 +3,7 @@
 
 #include <SDL2/SDL.h>
 #include <SDL2/SDL_ttf.h>
-#define Point SDL_Point
-#define FPoint SDL_FPoint
-#define Rect SDL_FRect
 #define Relative_Rect SDL_FRect
-#define Color SDL_Color
 
 #include <stdint.h>
 
@@ -16,7 +12,7 @@
 typedef struct
 {
        Relative_Rect rel;
-       Rect real;
+       SDL_FRect real;
 
        // bool
        // center in parent axis (even spacing on both sides?)
@@ -40,7 +36,7 @@ typedef struct
 
 typedef struct
 {
-       FPoint position;
+       SDL_FPoint position;
        uint32_t radius;
 
 } Circle;
@@ -48,7 +44,7 @@ typedef struct
 typedef struct
 {
        // Tabbing these to visually indicate layout
-       Rect window;
+       SDL_FRect window;
                Layout_Rect rgb_square; // big clicky draggy square
                Layout_Rect hue_slider; // HSV slider bar
                Layout_Rect info_container;
@@ -79,7 +75,7 @@ typedef struct
 
 typedef struct
 {
-       Color active_rgb;
+       SDL_Color active_rgb;
        HSL_Color active_hsl;
        Window_Layout layout;