Rev 1566 |
Rev 1713 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/*
* gravity.h
* DIN Is Noise is copyright (c) 2006-2021 Jagannathan Sampath
* For more information, please visit https://dinisnoise.org/
*/
#ifndef __GRAVITY
#define __GRAVITY
#include "widget.h"
#include "arrow_button.h"
#include "checkbutton.h"
#include "point.h"
struct drone;
struct gravity_t : widget, click_listener {
arrow_button fold;
button bzero, breset;
checkbutton keepsize;
int handle_size;
point<int> base;
point<int> tip;
point<int> base2tip;
point<int> p_base2tip;
point<int> bottomleft, topright;
point<int> textpos;
int hitt;
enum {NEXT_TO_NOTHING = -1, NOTHING, BASE, TIP};
int hit (const point<int>& p, int mx, int my);
int lmb_clicked;
float strength, strength0;
float gx, gy;
void set_strength (float s);
drone* tracked_drone;
double mag0, mag;
int keep_size;
void track ();
gravity_t ();
void load (std::ifstream& file);
void save (std::ofstream& file);
int handle_input ();
void set (point<int>& p, int mx, int my, int calc_mag = 1);
void dir (float vx, float vy);
void calc (int calc_mag = 1);
void reset (int keep_size = 0);
void zero ();
int stop_editing ();
int gl_base [8];
float gl_arrow[12];
void draw ();
void clicked (button& b);
};
#endif