File indexing completed on 2024-04-14 04:02:10
0001 /* 0002 SPDX-FileCopyrightText: 2008 Ian Wadham <iandw.au@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KBK_GLOBAL_H 0008 #define KBK_GLOBAL_H 0009 0010 // MACRO - Loop for i = 0 to (n-l). 0011 #define LOOP(i,n) for(int i=0; i<n; i++) 0012 0013 #ifdef WIN32 0014 #include <windows.h> // Needed to avoid errors when including OpenGL headers. 0015 #endif 0016 0017 #ifdef Q_OS_MAC 0018 #include <OpenGL/gl.h> 0019 #include <OpenGL/glu.h> 0020 #else 0021 #include <GL/gl.h> // Make OpenGL library and types available globally. 0022 #include <GL/glu.h> 0023 #endif 0024 0025 enum Axis {X, Y, Z, nAxes}; 0026 enum Rotation {ANTICLOCKWISE, CLOCKWISE, ONE_EIGHTY}; 0027 #define WHOLE_CUBE 99 0028 0029 enum SingmasterMove {SM_UP, SM_DOWN, SM_LEFT, SM_RIGHT, SM_FRONT, SM_BACK, 0030 SM_ANTICLOCKWISE, SM_DOUBLE, SM_2_SLICE, SM_ANTISLICE, 0031 SM_INNER, SM_EXECUTE, SM_CUBE, SM_SPACER}; 0032 const char SingmasterNotation [] = {"UDLRFB'2+-.xC "}; 0033 0034 enum Option {optXDim, optYDim, optZDim, optShuffleMoves, 0035 optViewShuffle, optViewMoves, optMoveSpeed, 0036 optBevel, optSceneID, optTumbling, optTumblingTicks, 0037 optMouseBlink, nOptions}; 0038 enum SceneID {OneCube = 1, TwoCubes, ThreeCubes, nSceneIDs}; 0039 #define TURNS true 0040 #define FIXED false 0041 enum LabelID {NoLabel, DemoLbl, FrontLbl, BackLbl}; 0042 enum BackgroundType {NO_LOAD, PICTURE, GRADIENT}; 0043 0044 enum MouseEvent {ButtonDown, Tracking, ButtonUp}; 0045 0046 #define viewAngle 30.0 // Angle of field of view in Y direction. 0047 static const double minZ = 1.0; // Nearest point represented in the view. 0048 static const double maxZ = 20.0; // Furthest point represented in the view. 0049 0050 #define cubeCentreZ -5.0 // Z-value for all centres of cubes. 0051 0052 #define defaultOwnMove 23 // Default degrees/frame for own moves. 0053 0054 typedef struct { // Define type "CubeView". 0055 int sceneID; // Scene ID (1, 2, or 3 cubes in scene). 0056 bool rotates; // True if user can rotate this cube. 0057 float size; // Overall size in GL co-ordinates. 0058 float relX; // Relative X-position of centre. 0059 float relY; // Relative Y-position of centre. 0060 float position [nAxes]; // GL co-ordinates of centre of cube. 0061 float turn; // Turn angle around Y axis. 0062 float tilt; // Tilt angle. 0063 GLdouble matrix0 [16]; // GL matrix for home position of cube. 0064 GLdouble matrix [16]; // GL matrix for current position. 0065 float cubieSize; // Size of cubies (for findSticker()). 0066 int labelX; // Label X posn. in 1/8ths widget size. 0067 int labelY; // Label Y posn. in 1/8ths widget size. 0068 LabelID label; // Index of label object and text. 0069 } CubeView; 0070 0071 typedef struct { // Define type "Move". 0072 Axis axis; // Axis of rotation. 0073 int slice; // Slice to be rotated. 0074 Rotation direction; // Direction to move. 0075 int degrees; // Angle of move (90 or 180 degrees). 0076 } Move; 0077 0078 #endif // KBK_GLOBAL_H