ui toggle func

parent 68dcd590
No preview for this file type
......@@ -32,8 +32,8 @@
int
mandelbrot(Complex c) {
// builb check
if ((c.real + 1.0) * (c.real + 1.0) + c.imag * c.imag <= 0.25)
return MAX_ITERATIONS;
//if ((c.real + 1.0) * (c.real + 1.0) + c.imag * c.imag <= 0.25)
// return MAX_ITERATIONS;
Complex z = {0.0, 0.0};
......@@ -122,7 +122,7 @@ render_cl(Array *arr, App *app, ViewInfo view) {
arr->size = app->win_height * app->win_width * sizeof(Color);
}
if (app->needs_recalc)
calculate_set(arr, app->win_height, app->win_width, view);
calculate_set(arr, app->win_height, app->win_width, view);
update_texture(app, arr);
......@@ -152,6 +152,7 @@ main(void)
SCREEN_WIDTH, SCREEN_HEIGHT),
SCREEN_HEIGHT,
SCREEN_WIDTH,
1,
1
};
......@@ -240,6 +241,9 @@ main(void)
app.needs_recalc = 1;
break;
case SDL_SCANCODE_H:
app.draw_ui = 1 - app.draw_ui;
break;
}
default:
//returns one if recalc needed
......@@ -263,7 +267,8 @@ main(void)
if(msec > 0)
fps = 1000.0 / (double) msec;
render_ui(&ui, app.renderer, view, fps);
if(app.draw_ui)
render_ui(&ui, app.renderer, view, fps);
SDL_RenderPresent(app.renderer);
app.needs_recalc = 0;
......
......@@ -6,7 +6,7 @@
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
#define MAX_ITERATIONS 500
#define MAX_ITERATIONS 250
typedef struct {
double real;
......@@ -20,6 +20,7 @@ typedef struct{
int win_height;
int win_width;
short unsigned int needs_recalc;
short unsigned int draw_ui;
} App ;
typedef struct{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment