Added new version of mandelbrot demo from Bill Spitzak.
git-svn-id: file:///fltk/svn/fltk/trunk@31 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
b2172ee88a
commit
c839b0fd30
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: mandelbrot.cxx,v 1.3 1998/10/21 14:21:33 mike Exp $"
|
// "$Id: mandelbrot.cxx,v 1.4 1998/10/21 16:35:17 mike Exp $"
|
||||||
//
|
//
|
||||||
// Mandelbrot set demo for the Fast Light Tool Kit (FLTK).
|
// Mandelbrot set demo for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -42,7 +42,7 @@ void set_idle() {
|
|||||||
static void window_callback(Fl_Widget*, void*) {exit(0);}
|
static void window_callback(Fl_Widget*, void*) {exit(0);}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
make_window(mbrot);
|
mbrot.make_window();
|
||||||
mbrot.d->X = -.75;
|
mbrot.d->X = -.75;
|
||||||
mbrot.d->scale = 2.5;
|
mbrot.d->scale = 2.5;
|
||||||
mbrot.update_label();
|
mbrot.update_label();
|
||||||
@ -162,7 +162,7 @@ int Drawing_Area::handle(int event) {
|
|||||||
new_display();
|
new_display();
|
||||||
} else if (!julia) {
|
} else if (!julia) {
|
||||||
if (!jbrot.d) {
|
if (!jbrot.d) {
|
||||||
make_window(jbrot);
|
jbrot.make_window();
|
||||||
jbrot.d->julia = 1;
|
jbrot.d->julia = 1;
|
||||||
jbrot.d->X = 0;
|
jbrot.d->X = 0;
|
||||||
jbrot.d->Y = 0;
|
jbrot.d->Y = 0;
|
||||||
@ -196,34 +196,6 @@ void Drawing_Area::resize(int X,int Y,int W,int H) {
|
|||||||
Fl_Box::resize(X,Y,W,H);
|
Fl_Box::resize(X,Y,W,H);
|
||||||
}
|
}
|
||||||
|
|
||||||
void brightness_slider_cb(Fl_Slider* o, Drawing_Window* s) {
|
|
||||||
s->d->brightness = int(o->value());
|
|
||||||
s->d->new_display();
|
|
||||||
}
|
|
||||||
|
|
||||||
void iterations_slider_cb(Fl_Slider* o, Drawing_Window* s) {
|
|
||||||
s->d->iterations = 1<<int(o->value());
|
|
||||||
s->d->new_display();
|
|
||||||
}
|
|
||||||
|
|
||||||
void x_callback(Fl_Input* o, Drawing_Window* s) {
|
|
||||||
double v = atof(o->value());
|
|
||||||
s->d->X = v;
|
|
||||||
s->d->new_display();
|
|
||||||
}
|
|
||||||
|
|
||||||
void y_callback(Fl_Input* o, Drawing_Window* s) {
|
|
||||||
double v = atof(o->value());
|
|
||||||
s->d->Y = v;
|
|
||||||
s->d->new_display();
|
|
||||||
}
|
|
||||||
|
|
||||||
void w_callback(Fl_Input* o, Drawing_Window* s) {
|
|
||||||
double v = atof(o->value());
|
|
||||||
s->d->scale = v;
|
|
||||||
s->d->new_display();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: mandelbrot.cxx,v 1.3 1998/10/21 14:21:33 mike Exp $".
|
// End of "$Id: mandelbrot.cxx,v 1.4 1998/10/21 16:35:17 mike Exp $".
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: mandelbrot.h,v 1.3 1998/10/21 14:21:34 mike Exp $"
|
// "$Id: mandelbrot.h,v 1.4 1998/10/21 16:35:18 mike Exp $"
|
||||||
//
|
//
|
||||||
// Mandelbrot set header file for the Fast Light Tool Kit (FLTK).
|
// Mandelbrot set header file for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -29,8 +29,6 @@
|
|||||||
#include <FL/Fl_Window.H>
|
#include <FL/Fl_Window.H>
|
||||||
#include <FL/Fl_Input.H>
|
#include <FL/Fl_Input.H>
|
||||||
|
|
||||||
class Drawing_Window;
|
|
||||||
|
|
||||||
class Drawing_Area : public Fl_Box {
|
class Drawing_Area : public Fl_Box {
|
||||||
void draw();
|
void draw();
|
||||||
public:
|
public:
|
||||||
@ -69,15 +67,6 @@ public:
|
|||||||
int idle();
|
int idle();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Drawing_Window {
|
|
||||||
public:
|
|
||||||
Drawing_Area *d;
|
|
||||||
Fl_Slider *gamma_slider;
|
|
||||||
Fl_Input *x_input, *y_input, *w_input;
|
|
||||||
Fl_Window *window;
|
|
||||||
void update_label();
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: mandelbrot.h,v 1.3 1998/10/21 14:21:34 mike Exp $".
|
// End of "$Id: mandelbrot.h,v 1.4 1998/10/21 16:35:18 mike Exp $".
|
||||||
//
|
//
|
||||||
|
@ -1,63 +1,74 @@
|
|||||||
# data file for FL User Interface Designer (fluid)
|
# data file for the Fltk User Interface Designer (fluid)
|
||||||
version 0.99
|
version 0.99
|
||||||
|
header_name {.H}
|
||||||
|
code_name {.C}
|
||||||
gridx 10
|
gridx 10
|
||||||
gridy 10
|
gridy 10
|
||||||
snap 3
|
snap 3
|
||||||
Function {make_window(Drawing_Window& s)} {open
|
decl {\#include "mandelbrot.H"} {public
|
||||||
|
}
|
||||||
|
|
||||||
|
decl {\#include <stdlib.h>} {}
|
||||||
|
|
||||||
|
class Drawing_Window {open
|
||||||
} {
|
} {
|
||||||
Fl_Window {s.window} {open
|
Function {make_window()} {open return_type void
|
||||||
xywh {92 109 429 510}
|
|
||||||
code0 {o->size_range(220,220);}
|
|
||||||
} {
|
} {
|
||||||
Fl_Box {s.d} {
|
Fl_Window window {open
|
||||||
user_data {&s} user_data_type {Drawing_Window*} open
|
xywh {178 479 450 520} resizable
|
||||||
xywh {10 70 410 430} box 3 color {0 47} resizable
|
code0 {o->size_range(220,220);} visible
|
||||||
code0 {\#include "mandelbrot.H"}
|
} {
|
||||||
class Drawing_Area
|
Fl_Box d {
|
||||||
}
|
user_data this user_data_type {void*} selected
|
||||||
Fl_Input {s.x_input} {
|
xywh {20 80 410 430} box DOWN_BOX color 0 selection_color 47 resizable
|
||||||
label {x:}
|
class Drawing_Area
|
||||||
user_data {&s} user_data_type {Drawing_Window*}
|
}
|
||||||
callback x_callback open
|
Fl_Input x_input {
|
||||||
xywh {20 5 125 30} type 1 box 7 color {8 7} labelfont 11 labelsize 20 textfont 11 textsize 20
|
label {x:}
|
||||||
code0 {o->when(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE);}
|
callback {d->X = atof(o->value());;
|
||||||
}
|
d->new_display();}
|
||||||
Fl_Input {s.y_input} {
|
xywh {30 15 125 30} type Float box THIN_DOWN_BOX color 8 selection_color 7 labelfont 11 labelsize 20 textfont 11 textsize 20
|
||||||
label {y:}
|
code0 {o->when(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE);}
|
||||||
user_data {&s} user_data_type {Drawing_Window*}
|
}
|
||||||
callback y_callback open
|
Fl_Input y_input {
|
||||||
xywh {165 5 125 30} type 1 box 7 color {8 7} labelfont 11 labelsize 20 textfont 11 textsize 20
|
label {y:}
|
||||||
code0 {o->when(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE);}
|
callback {d->Y = atof(o->value());
|
||||||
}
|
d->new_display();}
|
||||||
Fl_Input {s.w_input} {
|
xywh {175 15 125 30} type Float box THIN_DOWN_BOX color 8 selection_color 7 labelfont 11 labelsize 20 textfont 11 textsize 20
|
||||||
label {w:}
|
code0 {o->when(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE);}
|
||||||
user_data {&s} user_data_type {Drawing_Window*}
|
}
|
||||||
callback w_callback open
|
Fl_Input w_input {
|
||||||
xywh {315 5 105 30} type 1 box 7 color {8 7} labelfont 11 labelsize 20 textfont 11 textsize 20
|
label {w:}
|
||||||
code0 {o->when(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE);}
|
callback {d->scale = atof(o->value());
|
||||||
}
|
d->new_display();}
|
||||||
Fl_Slider {} {
|
xywh {325 15 105 30} type Float box THIN_DOWN_BOX color 8 selection_color 7 labelfont 11 labelsize 20 textfont 11 textsize 20
|
||||||
label {brightness:}
|
code0 {o->when(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE);}
|
||||||
user_data {&s} user_data_type {Drawing_Window*}
|
}
|
||||||
callback brightness_slider_cb open
|
Fl_Slider {} {
|
||||||
xywh {70 40 160 15} type 1 box 7 labelsize 10 align 4 step 1 slider_size 0.1
|
label {brightness:}
|
||||||
code0 {o->bounds(0,s.d->MAX_BRIGHTNESS);}
|
callback {d->brightness = int(o->value());
|
||||||
code2 {o->value(s.d->DEFAULT_BRIGHTNESS);}
|
d->new_display();}
|
||||||
code3 {o->slider(FL_UP_BOX);}
|
xywh {80 50 160 15} type Horizontal box THIN_DOWN_BOX labelsize 10 align 4 step 1 slider_size 0.1
|
||||||
}
|
code0 {o->bounds(0,d->MAX_BRIGHTNESS);}
|
||||||
Fl_Box {} {
|
code2 {o->value(d->DEFAULT_BRIGHTNESS);}
|
||||||
label {left: click = zoom out, drag = zoom in
|
code3 {o->slider(FL_UP_BOX);}
|
||||||
right click: Julia set} open
|
}
|
||||||
xywh {230 40 190 30} labelsize 10 align 24 deactivate
|
Fl_Box {} {
|
||||||
}
|
label {left: click = zoom out, drag = zoom in
|
||||||
Fl_Slider {} {
|
right click: Julia set}
|
||||||
label {iterations:}
|
xywh {240 50 190 30} labelsize 10 align 24 deactivate
|
||||||
user_data {&s} user_data_type {Drawing_Window*}
|
}
|
||||||
callback iterations_slider_cb open selected
|
Fl_Slider {} {
|
||||||
xywh {70 55 160 15} type 1 box 7 labelsize 10 align 4 step 1 slider_size 0.1
|
label {iterations:}
|
||||||
code0 {o->bounds(1,s.d->MAX_ITERATIONS);}
|
callback {d->iterations = 1<<int(o->value());
|
||||||
code2 {o->value(s.d->DEFAULT_ITERATIONS);}
|
d->new_display();}
|
||||||
code3 {o->slider(FL_UP_BOX);}
|
xywh {80 65 160 15} type Horizontal box THIN_DOWN_BOX labelsize 10 align 4 step 1 slider_size 0.1
|
||||||
|
code0 {o->bounds(1,d->MAX_ITERATIONS);}
|
||||||
|
code2 {o->value(d->DEFAULT_ITERATIONS);}
|
||||||
|
code3 {o->slider(FL_UP_BOX);}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
decl {void update_label();} {public
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user