1 //------------------------------------------------------------------------ 2 // OBJECT STUFF 3 //------------------------------------------------------------------------ 4 // 5 // Eureka DOOM Editor 6 // 7 // Copyright (C) 2001-2016 Andrew Apted 8 // Copyright (C) 1997-2003 André Majorel et al 9 // 10 // This program is free software; you can redistribute it and/or 11 // modify it under the terms of the GNU General Public License 12 // as published by the Free Software Foundation; either version 2 13 // of the License, or (at your option) any later version. 14 // 15 // This program is distributed in the hope that it will be useful, 16 // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 // GNU General Public License for more details. 19 // 20 //------------------------------------------------------------------------ 21 // 22 // Based on Yadex which incorporated code from DEU 5.21 that was put 23 // in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. 24 // 25 //------------------------------------------------------------------------ 26 27 #ifndef __EUREKA_OBJECTS_H__ 28 #define __EUREKA_OBJECTS_H__ 29 30 31 void MoveObjects(selection_c *list, double delta_x, double delta_y, double delta_z = 0); 32 void DragSingleObject(Objid& obj, double delta_x, double delta_y, double delta_z = 0); 33 34 void DeleteObjects(selection_c * list); 35 36 bool LineTouchesBox(int ld, double x0, double y0, double x1, double y1); 37 38 void GetDragFocus(double *x, double *y, double ptr_x, double ptr_y); 39 40 41 struct transform_t 42 { 43 public: 44 double mid_x, mid_y; 45 double scale_x, scale_y; 46 double skew_x, skew_y; 47 48 int rotate; // 16 bits (65536 = 360 degrees) 49 50 public: 51 void Clear(); 52 53 void Apply(double *x, double *y) const; 54 }; 55 56 57 typedef enum 58 { 59 TRANS_K_Scale = 0, // scale and keep aspect 60 TRANS_K_Stretch, // scale X and Y independently 61 TRANS_K_Rotate, // rotate 62 TRANS_K_RotScale, // rotate and scale at same time 63 TRANS_K_Skew // skew (shear) along an axis 64 65 } transform_keyword_e; 66 67 68 void Objs_CalcMiddle(selection_c * list, double *x, double *y); 69 void Objs_CalcBBox(selection_c * list, double *x1, double *y1, double *x2, double *y2); 70 71 void TransformObjects(transform_t& param); 72 73 void ScaleObjects3(double scale_x, double scale_y, double pos_x, double pos_y); 74 void ScaleObjects4(double scale_x, double scale_y, double scale_z, 75 double pos_x, double pos_y, double pos_z); 76 77 void RotateObjects3(double deg, double pos_x, double pos_y); 78 79 80 /* commands */ 81 82 void CMD_Insert(); 83 84 void CMD_CopyProperties(); 85 86 void CMD_Mirror (); 87 void CMD_Rotate90(); 88 void CMD_Enlarge (); 89 void CMD_Shrink (); 90 void CMD_Quantize(); 91 92 93 #endif /* __EUREKA_OBJECTS_H__ */ 94 95 //--- editor settings --- 96 // vi:ts=4:sw=4:noexpandtab 97