Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mandelbrot-explorer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ильин Владимир Александрович
mandelbrot-explorer
Commits
b9f4743d
Commit
b9f4743d
authored
1 month ago
by
Ильин Владимир Александрович
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ui toggle func
parent
68dcd590
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
+11
-5
mandelbrot
mandelbrot
+0
-0
mandelbrot.c
src/mandelbrot.c
+9
-4
mandelbrot.h
src/mandelbrot.h
+2
-1
No files found.
mandelbrot
View file @
b9f4743d
No preview for this file type
This diff is collapsed.
Click to expand it.
src/mandelbrot.c
View file @
b9f4743d
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
src/mandelbrot.h
View file @
b9f4743d
...
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment