Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*#include<iostream>
- #include <FL/Fl.H>
- #include <FL/Fl_Window.H>
- #include <FL/Fl_Box.H>
- #include <FL/Fl_Button.H>
- #include <FL/Fl_Int_Input.H>
- #include <FL/Fl_Value_Input.H>
- #include <FL/Fl_Int_Input.H>
- #include <FL/fl_ask.H>
- Fl_Int_Input* input[5];
- Fl_Value_Input* input1[5];
- using namespace std;
- void beepcb(Fl_Widget*)
- {
- fl_beep();
- fflush(stdout);
- int h = input[1]->(int)value();
- Fl_Window* spiral = new Fl_Window(input[1]->(int)value(), input[2]->value);
- spiral->end();
- spiral->show();
- }
- void drawnew(Fl_Widget*, void*)
- {
- }
- int main(int argc, char **argv)
- {
- Fl_Window *window = new Fl_Window(330,250);
- //Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!");
- //box->box(FL_UP_BOX);
- //box->labelsize(36);
- //box->labeltype(FL_SHADOW_LABEL);
- #pragma region Input
- int y = 10;
- input[0] = new Fl_Int_Input(100, y, 200, 30, "SpiralName:"); y += 35;
- input[0]->tooltip("Spiral Name input field (F1)");
- input[0]->shortcut(FL_F + 1);
- // input[0]->cursor_color(FL_SELECTION_COLOR);
- // input[0]->maximum_size(20);
- // input[0]->static_value("this is a testgarbage");
- input[1] = new Fl_Int_Input(100, y, 200, 30, "Win_Height:"); y += 35;
- input[1]->tooltip("Input field for Window Height (F2)");
- input[1]->shortcut(FL_F + 2);
- input[2] = new Fl_Int_Input(100, y, 200, 30, "Win_Weight:"); y += 35;
- input[2]->tooltip("Input field for Window Weight (F3)");
- input[2]->shortcut(FL_F + 3);
- input[3] = new Fl_Int_Input(100, y, 200, 30, "Spiral_H:"); y += 35;
- input[3]->tooltip("Input field for Spiral H (F4)");
- input[3]->shortcut(FL_F + 4);
- input[4] = new Fl_Int_Input(100, y, 200, 30, "Spiral_T:"); y += 35;
- input[4]->tooltip("Input field for Spiral Degree (T) (F5)");
- input[4]->shortcut(FL_F + 5);
- Fl_Button* b1 = new Fl_Button(150, y, 100, 30, "&Draw!");
- b1->callback(beepcb);
- #pragma endregion
- window->end();
- window->show(argc, argv);
- return Fl::run();
- }*/
- #define _USE_MATH_DEFINES
- #include <iostream>
- #include <math.h>
- #include <FL/Fl.H>
- #include <FL/Fl_Double_Window.H>
- Fl_Double_Window* SS = (Fl_Double_Window*)0;
- Fl_Double_Window* SD = (Fl_Double_Window*)0;
- #include <FL/Fl_Int_Input.H>
- #include <FL/Fl_Float_Input.H>
- Fl_Int_Input* WH = (Fl_Int_Input*)0;
- Fl_Int_Input* WW = (Fl_Int_Input*)0;
- Fl_Int_Input* H = (Fl_Int_Input*)0;
- Fl_Float_Input* T = (Fl_Float_Input*)0;
- #include <FL/Fl_Button.H>
- #include <FL/fl_ask.H>
- Fl_Button* Dbut = (Fl_Button*)0;
- Fl_Button* DBS[1000]; //объявление массива DBS
- #include "inactive.h"
- int A = 1;
- int B = 1;
- //122
- static void cb_Dbut(Fl_Button*, void*)
- {
- fl_beep();
- fflush(stdout);
- A = atoi(WH->value());
- B = atoi(WW->value());
- if (A < 400 || B < 400)
- {
- A = 400; B = 400;
- }
- if (A > 800 || B > 800)
- {
- A = 800; B = 800;
- }
- SD = new Fl_Double_Window(1 * A, 1 * B, "Spiral");
- A /= 2;
- B /= 2;
- //printf("fsf");
- //fflush(stdout);
- static double p, h,
- t,
- x, y;
- //printf("fsf2");
- //fflush(stdout);
- sscanf(H->value(), "%lf", &h);
- if (h > 20)
- h = 20;
- else if (h < 0.1)
- h = 0.1;
- //printf("fsf3");
- //fflush(stdout);
- sscanf(T->value(), "%lf", &t);
- if (t > 1)
- t = 1;
- else if (t <0.1)
- t= 0.1;
- /*h = atoi(H->value());
- t = atoi(T->value());
- */
- //printf("fs243");
- //fflush(stdout);
- const char C/*[]*/ = 'a';// "abcdefghijklmnopqrstuvwxyz";
- for (short i = 0; i < 1000; i++,C) {
- int b = 0;
- p = (h / M_2_PI) * t * i;
- x = p * cos(t * i);
- y = p * sin(t * i);
- DBS[i] = new Fl_Button(x + A, y + B, 15, 15, &C);
- /*DBS[i]->box(FL_PLASTIC_UP_BOX);
- DBS[i]->labelcolor(FL_GRAY0);*/
- DBS[i]->deactivate();
- b++;
- if (b == 26)
- b = 0;
- }
- SD->end();
- SD->show();
- }
- int main(int argc, char** argv) {
- int y = 10;
- { SS = new Fl_Double_Window(330, 250, "Spiral Settings");
- {
- WH = new Fl_Int_Input(100, y, 200, 30, "Win_Height:"); y += 35;
- WH->tooltip("Input field for Window Height (Min: 400/Max: 1000)(F1)");
- WH->shortcut(FL_F + 1);
- } // Fl_Int_Input* o
- {
- WW = new Fl_Int_Input(100, y, 200, 30, "Win_Weight:"); y += 35;
- WW->tooltip("Input field for Window Weight (Min: 400/Max: 1000) (F2)");
- WW->shortcut(FL_F + 2);
- } // Fl_Int_Input* o
- {
- H = new Fl_Int_Input(100, y, 200, 30, "Spiral_H:"); y += 35;
- H->tooltip("Input field for Spiral (Min: 1/Max: 20) H (F3)");
- H->shortcut(FL_F + 3);
- }
- {
- T = new Fl_Float_Input(100, y, 200, 30, "Spiral_T:"); y += 35;
- T->tooltip("Input field for Spiral degree (Min: 0.1/Max: 0.5) (T) (F4)");
- T->shortcut(FL_F + 4);
- }
- {
- Dbut = new Fl_Button(100, y, 200, 30, "Draw!");
- Dbut->tooltip("To draw a spiral press (F5)");
- Dbut->shortcut(FL_F + 5);
- Dbut->callback((Fl_Callback*)cb_Dbut);
- } // Fl_Button* Dbut
- SS->end();
- }
- SS->show(argc, argv);
- return Fl::run();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement