mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-04 04:50:22 +00:00
Minimize and remove custom / dead FreeGLUT changes
This commit is contained in:
parent
68413c0fc3
commit
a5f62e1cf6
|
@ -11,6 +11,7 @@
|
|||
# Download the latest 2.x release from https://freeglut.sourceforge.net/
|
||||
# Copy all .c files from the src directory into internal/c/parts/core/freeglut (after making QB64-PE specific changes)
|
||||
# Copy the include directory to internal/c/parts/core/freeglut
|
||||
# Compile the source using -DFREEGLUT_STATIC
|
||||
|
||||
FREEGLUT_SRCS := $(wildcard $(PATH_INTERNAL_C)/parts/core/freeglut/*.c)
|
||||
GLEW_SRCS := $(PATH_INTERNAL_C)/parts/core/glew/glew.c
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_callbacks.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_cursor.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_display.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_ext.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_font.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
\file og_font_data.c
|
||||
\brief Bitmapped font data for OpenGLUT fonts.
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_gamemode.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_geometry.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_glutfont_definitions.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_init.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_input_devices.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_joystick.c
|
||||
*
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
|
||||
/*
|
||||
* freeglut_main.c
|
||||
*
|
||||
|
@ -43,305 +39,20 @@
|
|||
# define VFPRINTF(s,f,a)
|
||||
#endif
|
||||
|
||||
int qb64_custom_event(int event,int v1,int v2,int v3,int v4,int v5,int v6,int v7,int v8,void *p1,void *p2);
|
||||
#if TARGET_HOST_POSIX_X11
|
||||
void qb64_os_event_linux(XEvent *event, Display *display, int *qb64_os_event_info);
|
||||
#else
|
||||
LRESULT qb64_os_event_windows(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, int *qb64_os_event_info);
|
||||
#endif
|
||||
// QB64-PE Custom Code
|
||||
#include "../../../libqb/include/keyhandler.h"
|
||||
|
||||
#define QB64_EVENT_CLOSE 1
|
||||
#define QB64_EVENT_KEY 2
|
||||
#define QB64_EVENT_RELATIVE_MOUSE_MOVEMENT 3
|
||||
#define QB64_EVENT_FILE_DROP 4
|
||||
|
||||
#define QBK 200000
|
||||
#define VK 100000
|
||||
#define UC 1073741824
|
||||
/* QBK codes:
|
||||
200000-200010: Numpad keys with Num-Lock off
|
||||
NO_NUMLOCK_KP0=INSERT
|
||||
NO_NUMLOCK_KP1=END
|
||||
NO_NUMLOCK_KP2=DOWN
|
||||
NO_NUMLOCK_KP3=PGDOWN
|
||||
NO_NUMLOCK_KP4...
|
||||
NO_NUMLOCK_KP5
|
||||
NO_NUMLOCK_KP6
|
||||
NO_NUMLOCK_KP7
|
||||
NO_NUMLOCK_KP8
|
||||
NO_NUMLOCK_KP9
|
||||
NO_NUMLOCK_KP_PERIOD=DEL
|
||||
200011: SCROLL_LOCK_ON
|
||||
200012: INSERT_MODE_ON
|
||||
*/
|
||||
#define QBK_SCROLL_LOCK_MODE 11
|
||||
#define QBK_INSERT_MODE 12
|
||||
#define QBK_CHR0 13
|
||||
typedef enum {
|
||||
QBVK_UNKNOWN = 0,
|
||||
QBVK_FIRST = 0,
|
||||
QBVK_BACKSPACE = 8,
|
||||
QBVK_TAB = 9,
|
||||
QBVK_CLEAR = 12,
|
||||
QBVK_RETURN = 13,
|
||||
QBVK_PAUSE = 19,
|
||||
QBVK_ESCAPE = 27,
|
||||
QBVK_SPACE = 32,
|
||||
QBVK_EXCLAIM = 33,
|
||||
QBVK_QUOTEDBL = 34,
|
||||
QBVK_HASH = 35,
|
||||
QBVK_DOLLAR = 36,
|
||||
QBVK_AMPERSAND = 38,
|
||||
QBVK_QUOTE = 39,
|
||||
QBVK_LEFTPAREN = 40,
|
||||
QBVK_RIGHTPAREN = 41,
|
||||
QBVK_ASTERISK = 42,
|
||||
QBVK_PLUS = 43,
|
||||
QBVK_COMMA = 44,
|
||||
QBVK_MINUS = 45,
|
||||
QBVK_PERIOD = 46,
|
||||
QBVK_SLASH = 47,
|
||||
QBVK_0 = 48,
|
||||
QBVK_1 = 49,
|
||||
QBVK_2 = 50,
|
||||
QBVK_3 = 51,
|
||||
QBVK_4 = 52,
|
||||
QBVK_5 = 53,
|
||||
QBVK_6 = 54,
|
||||
QBVK_7 = 55,
|
||||
QBVK_8 = 56,
|
||||
QBVK_9 = 57,
|
||||
QBVK_COLON = 58,
|
||||
QBVK_SEMICOLON = 59,
|
||||
QBVK_LESS = 60,
|
||||
QBVK_EQUALS = 61,
|
||||
QBVK_GREATER = 62,
|
||||
QBVK_QUESTION = 63,
|
||||
QBVK_AT = 64,
|
||||
//Skip uppercase letters
|
||||
QBVK_LEFTBRACKET= 91,
|
||||
QBVK_BACKSLASH = 92,
|
||||
QBVK_RIGHTBRACKET = 93,
|
||||
QBVK_CARET = 94,
|
||||
QBVK_UNDERSCORE = 95,
|
||||
QBVK_BACKQUOTE = 96,
|
||||
QBVK_a = 97,
|
||||
QBVK_b = 98,
|
||||
QBVK_c = 99,
|
||||
QBVK_d = 100,
|
||||
QBVK_e = 101,
|
||||
QBVK_f = 102,
|
||||
QBVK_g = 103,
|
||||
QBVK_h = 104,
|
||||
QBVK_i = 105,
|
||||
QBVK_j = 106,
|
||||
QBVK_k = 107,
|
||||
QBVK_l = 108,
|
||||
QBVK_m = 109,
|
||||
QBVK_n = 110,
|
||||
QBVK_o = 111,
|
||||
QBVK_p = 112,
|
||||
QBVK_q = 113,
|
||||
QBVK_r = 114,
|
||||
QBVK_s = 115,
|
||||
QBVK_t = 116,
|
||||
QBVK_u = 117,
|
||||
QBVK_v = 118,
|
||||
QBVK_w = 119,
|
||||
QBVK_x = 120,
|
||||
QBVK_y = 121,
|
||||
QBVK_z = 122,
|
||||
QBVK_DELETE = 127,
|
||||
//End of ASCII mapped QBVKs
|
||||
//International QBVKs
|
||||
QBVK_WORLD_0 = 160, /* 0xA0 */
|
||||
QBVK_WORLD_1 = 161,
|
||||
QBVK_WORLD_2 = 162,
|
||||
QBVK_WORLD_3 = 163,
|
||||
QBVK_WORLD_4 = 164,
|
||||
QBVK_WORLD_5 = 165,
|
||||
QBVK_WORLD_6 = 166,
|
||||
QBVK_WORLD_7 = 167,
|
||||
QBVK_WORLD_8 = 168,
|
||||
QBVK_WORLD_9 = 169,
|
||||
QBVK_WORLD_10 = 170,
|
||||
QBVK_WORLD_11 = 171,
|
||||
QBVK_WORLD_12 = 172,
|
||||
QBVK_WORLD_13 = 173,
|
||||
QBVK_WORLD_14 = 174,
|
||||
QBVK_WORLD_15 = 175,
|
||||
QBVK_WORLD_16 = 176,
|
||||
QBVK_WORLD_17 = 177,
|
||||
QBVK_WORLD_18 = 178,
|
||||
QBVK_WORLD_19 = 179,
|
||||
QBVK_WORLD_20 = 180,
|
||||
QBVK_WORLD_21 = 181,
|
||||
QBVK_WORLD_22 = 182,
|
||||
QBVK_WORLD_23 = 183,
|
||||
QBVK_WORLD_24 = 184,
|
||||
QBVK_WORLD_25 = 185,
|
||||
QBVK_WORLD_26 = 186,
|
||||
QBVK_WORLD_27 = 187,
|
||||
QBVK_WORLD_28 = 188,
|
||||
QBVK_WORLD_29 = 189,
|
||||
QBVK_WORLD_30 = 190,
|
||||
QBVK_WORLD_31 = 191,
|
||||
QBVK_WORLD_32 = 192,
|
||||
QBVK_WORLD_33 = 193,
|
||||
QBVK_WORLD_34 = 194,
|
||||
QBVK_WORLD_35 = 195,
|
||||
QBVK_WORLD_36 = 196,
|
||||
QBVK_WORLD_37 = 197,
|
||||
QBVK_WORLD_38 = 198,
|
||||
QBVK_WORLD_39 = 199,
|
||||
QBVK_WORLD_40 = 200,
|
||||
QBVK_WORLD_41 = 201,
|
||||
QBVK_WORLD_42 = 202,
|
||||
QBVK_WORLD_43 = 203,
|
||||
QBVK_WORLD_44 = 204,
|
||||
QBVK_WORLD_45 = 205,
|
||||
QBVK_WORLD_46 = 206,
|
||||
QBVK_WORLD_47 = 207,
|
||||
QBVK_WORLD_48 = 208,
|
||||
QBVK_WORLD_49 = 209,
|
||||
QBVK_WORLD_50 = 210,
|
||||
QBVK_WORLD_51 = 211,
|
||||
QBVK_WORLD_52 = 212,
|
||||
QBVK_WORLD_53 = 213,
|
||||
QBVK_WORLD_54 = 214,
|
||||
QBVK_WORLD_55 = 215,
|
||||
QBVK_WORLD_56 = 216,
|
||||
QBVK_WORLD_57 = 217,
|
||||
QBVK_WORLD_58 = 218,
|
||||
QBVK_WORLD_59 = 219,
|
||||
QBVK_WORLD_60 = 220,
|
||||
QBVK_WORLD_61 = 221,
|
||||
QBVK_WORLD_62 = 222,
|
||||
QBVK_WORLD_63 = 223,
|
||||
QBVK_WORLD_64 = 224,
|
||||
QBVK_WORLD_65 = 225,
|
||||
QBVK_WORLD_66 = 226,
|
||||
QBVK_WORLD_67 = 227,
|
||||
QBVK_WORLD_68 = 228,
|
||||
QBVK_WORLD_69 = 229,
|
||||
QBVK_WORLD_70 = 230,
|
||||
QBVK_WORLD_71 = 231,
|
||||
QBVK_WORLD_72 = 232,
|
||||
QBVK_WORLD_73 = 233,
|
||||
QBVK_WORLD_74 = 234,
|
||||
QBVK_WORLD_75 = 235,
|
||||
QBVK_WORLD_76 = 236,
|
||||
QBVK_WORLD_77 = 237,
|
||||
QBVK_WORLD_78 = 238,
|
||||
QBVK_WORLD_79 = 239,
|
||||
QBVK_WORLD_80 = 240,
|
||||
QBVK_WORLD_81 = 241,
|
||||
QBVK_WORLD_82 = 242,
|
||||
QBVK_WORLD_83 = 243,
|
||||
QBVK_WORLD_84 = 244,
|
||||
QBVK_WORLD_85 = 245,
|
||||
QBVK_WORLD_86 = 246,
|
||||
QBVK_WORLD_87 = 247,
|
||||
QBVK_WORLD_88 = 248,
|
||||
QBVK_WORLD_89 = 249,
|
||||
QBVK_WORLD_90 = 250,
|
||||
QBVK_WORLD_91 = 251,
|
||||
QBVK_WORLD_92 = 252,
|
||||
QBVK_WORLD_93 = 253,
|
||||
QBVK_WORLD_94 = 254,
|
||||
QBVK_WORLD_95 = 255, /* 0xFF */
|
||||
//Numeric keypad
|
||||
QBVK_KP0 = 256,
|
||||
QBVK_KP1 = 257,
|
||||
QBVK_KP2 = 258,
|
||||
QBVK_KP3 = 259,
|
||||
QBVK_KP4 = 260,
|
||||
QBVK_KP5 = 261,
|
||||
QBVK_KP6 = 262,
|
||||
QBVK_KP7 = 263,
|
||||
QBVK_KP8 = 264,
|
||||
QBVK_KP9 = 265,
|
||||
QBVK_KP_PERIOD = 266,
|
||||
QBVK_KP_DIVIDE = 267,
|
||||
QBVK_KP_MULTIPLY = 268,
|
||||
QBVK_KP_MINUS = 269,
|
||||
QBVK_KP_PLUS = 270,
|
||||
QBVK_KP_ENTER = 271,
|
||||
QBVK_KP_EQUALS = 272,
|
||||
//Arrows + Home/End pad
|
||||
QBVK_UP = 273,
|
||||
QBVK_DOWN = 274,
|
||||
QBVK_RIGHT = 275,
|
||||
QBVK_LEFT = 276,
|
||||
QBVK_INSERT = 277,
|
||||
QBVK_HOME = 278,
|
||||
QBVK_END = 279,
|
||||
QBVK_PAGEUP = 280,
|
||||
QBVK_PAGEDOWN = 281,
|
||||
//Function keys
|
||||
QBVK_F1 = 282,
|
||||
QBVK_F2 = 283,
|
||||
QBVK_F3 = 284,
|
||||
QBVK_F4 = 285,
|
||||
QBVK_F5 = 286,
|
||||
QBVK_F6 = 287,
|
||||
QBVK_F7 = 288,
|
||||
QBVK_F8 = 289,
|
||||
QBVK_F9 = 290,
|
||||
QBVK_F10 = 291,
|
||||
QBVK_F11 = 292,
|
||||
QBVK_F12 = 293,
|
||||
QBVK_F13 = 294,
|
||||
QBVK_F14 = 295,
|
||||
QBVK_F15 = 296,
|
||||
//Key state modifier keys
|
||||
QBVK_NUMLOCK = 300,
|
||||
QBVK_CAPSLOCK = 301,
|
||||
QBVK_SCROLLOCK = 302,
|
||||
QBVK_RSHIFT = 303,
|
||||
QBVK_LSHIFT = 304,
|
||||
QBVK_RCTRL = 305,
|
||||
QBVK_LCTRL = 306,
|
||||
QBVK_RALT = 307,
|
||||
QBVK_LALT = 308,
|
||||
QBVK_RMETA = 309,
|
||||
QBVK_LMETA = 310,
|
||||
QBVK_LSUPER = 311, /* Left "Windows" key */
|
||||
QBVK_RSUPER = 312, /* Right "Windows" key */
|
||||
QBVK_MODE = 313, /* "Alt Gr" key */
|
||||
QBVK_COMPOSE = 314, /* Multi-key compose key */
|
||||
//Miscellaneous function keys
|
||||
QBVK_HELP = 315,
|
||||
QBVK_PRINT = 316,
|
||||
QBVK_SYSREQ = 317,
|
||||
QBVK_BREAK = 318,
|
||||
QBVK_MENU = 319,
|
||||
QBVK_POWER = 320, /* Power Macintosh power key */
|
||||
QBVK_EURO = 321, /* Some european keyboards */
|
||||
QBVK_UNDO = 322, /* Atari keyboard has Undo */
|
||||
QBVK_LAST
|
||||
}QBVKs;
|
||||
//Enumeration of valid key mods (possibly OR'd together)
|
||||
typedef enum {
|
||||
KMOD_NONE = 0x0000,
|
||||
KMOD_LSHIFT= 0x0001,
|
||||
KMOD_RSHIFT= 0x0002,
|
||||
KMOD_LCTRL = 0x0040,
|
||||
KMOD_RCTRL = 0x0080,
|
||||
KMOD_LALT = 0x0100,
|
||||
KMOD_RALT = 0x0200,
|
||||
KMOD_LMETA = 0x0400,
|
||||
KMOD_RMETA = 0x0800,
|
||||
KMOD_NUM = 0x1000,
|
||||
KMOD_CAPS = 0x2000,
|
||||
KMOD_MODE = 0x4000,
|
||||
KMOD_RESERVED = 0x8000
|
||||
}KMODs;
|
||||
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
|
||||
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
|
||||
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
|
||||
#define KMOD_META (KMOD_LMETA|KMOD_RMETA)
|
||||
|
||||
int qb64_custom_event(int event, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, void *p1, void *p2);
|
||||
#if TARGET_HOST_POSIX_X11
|
||||
void qb64_os_event_linux(XEvent *event, Display *display, int *qb64_os_event_info);
|
||||
#else
|
||||
LRESULT qb64_os_event_windows(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, int *qb64_os_event_info);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
|
@ -1307,24 +1018,23 @@ void FGAPIENTRY glutMainLoopEvent( void )
|
|||
fghPrintEvent( &event );
|
||||
#endif
|
||||
|
||||
int qb64_os_event_info=0;
|
||||
int qb64_os_event_info = 0;
|
||||
|
||||
qb64_os_event_info=1;
|
||||
qb64_os_event_info = 1;
|
||||
qb64_os_event_linux(&event, fgDisplay.Display, &qb64_os_event_info);
|
||||
if (qb64_os_event_info==3) return;
|
||||
if (qb64_os_event_info == 3)
|
||||
return;
|
||||
|
||||
switch( event.type )
|
||||
{
|
||||
switch (event.type) {
|
||||
case ClientMessage:
|
||||
if(fgIsSpaceballXEvent(&event)) {
|
||||
if (fgIsSpaceballXEvent(&event)) {
|
||||
fgSpaceballHandleXEvent(&event);
|
||||
break;
|
||||
}
|
||||
/* Destroy the window when the WM_DELETE_WINDOW message arrives */
|
||||
if( (Atom) event.xclient.data.l[ 0 ] == fgDisplay.DeleteWindow )
|
||||
{
|
||||
GETWINDOW( xclient );
|
||||
qb64_custom_event(QB64_EVENT_CLOSE,0,0,0,0,0,0,0,0,NULL,NULL);
|
||||
if ((Atom)event.xclient.data.l[0] == fgDisplay.DeleteWindow) {
|
||||
GETWINDOW(xclient);
|
||||
qb64_custom_event(QB64_EVENT_CLOSE, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
/* fgDestroyWindow ( window );
|
||||
|
||||
if( fgState.ActionOnWindowClose == GLUT_ACTION_EXIT )
|
||||
|
@ -1765,10 +1475,10 @@ void FGAPIENTRY glutMainLoopEvent( void )
|
|||
break;
|
||||
}
|
||||
|
||||
qb64_os_event_info=2;
|
||||
qb64_os_event_info = 2;
|
||||
qb64_os_event_linux(&event, fgDisplay.Display, &qb64_os_event_info);
|
||||
if (qb64_os_event_info==3) return;//(although we would return anyway)
|
||||
|
||||
if (qb64_os_event_info == 3)
|
||||
return; //(although we would return anyway)
|
||||
}
|
||||
|
||||
#elif TARGET_HOST_MS_WINDOWS
|
||||
|
@ -1919,18 +1629,15 @@ static int fghGetWin32Modifiers (void)
|
|||
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
int qb64_os_event_info = 0;
|
||||
LRESULT qb64_os_event_return = 1;
|
||||
|
||||
int qb64_os_event_info=0;
|
||||
LRESULT qb64_os_event_return=1;
|
||||
qb64_os_event_info = 1;
|
||||
qb64_os_event_return = qb64_os_event_windows(hWnd, uMsg, wParam, lParam, &qb64_os_event_info);
|
||||
if (qb64_os_event_info == 3)
|
||||
return qb64_os_event_return;
|
||||
|
||||
qb64_os_event_info=1;
|
||||
qb64_os_event_return=qb64_os_event_windows(
|
||||
hWnd, uMsg, wParam,lParam, &qb64_os_event_info
|
||||
);
|
||||
if (qb64_os_event_info==3) return qb64_os_event_return;
|
||||
|
||||
static unsigned char lControl = 0, rControl = 0, lShift = 0,
|
||||
rShift = 0, lAlt = 0, rAlt = 0;
|
||||
static unsigned char lControl = 0, rControl = 0, lShift = 0, rShift = 0, lAlt = 0, rAlt = 0;
|
||||
|
||||
SFG_Window* window;
|
||||
PAINTSTRUCT ps;
|
||||
|
@ -2225,19 +1932,18 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
|||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
|
||||
//QB64
|
||||
/*
|
||||
// QB64
|
||||
/*
|
||||
fgDestroyWindow ( window );
|
||||
if ( fgState.ActionOnWindowClose != GLUT_ACTION_CONTINUE_EXECUTION )
|
||||
PostQuitMessage(0);
|
||||
*/
|
||||
qb64_custom_event(QB64_EVENT_CLOSE,0,0,0,0,0,0,0,0,NULL,NULL);
|
||||
*/
|
||||
qb64_custom_event(QB64_EVENT_CLOSE, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
|
||||
break;
|
||||
|
||||
case WM_DROPFILES:
|
||||
qb64_custom_event(QB64_EVENT_FILE_DROP,0,0,0,0,0,0,0,0,(void*)wParam,NULL);
|
||||
qb64_custom_event(QB64_EVENT_FILE_DROP, 0, 0, 0, 0, 0, 0, 0, 0, (void *)wParam, NULL);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
|
@ -2246,44 +1952,36 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
|||
*/
|
||||
return 0;
|
||||
|
||||
|
||||
static int raw_setup=0;
|
||||
static int raw_setup = 0;
|
||||
static RAWINPUTDEVICE Rid[1];
|
||||
case WM_INPUT:
|
||||
{
|
||||
if (raw_setup){
|
||||
//QB64
|
||||
//adapted from http://msdn.microsoft.com/en-us/library/windows/desktop/ee418864%28v=vs.85%29.aspx#WM_INPUT
|
||||
case WM_INPUT: {
|
||||
if (raw_setup) {
|
||||
// QB64
|
||||
// adapted from http://msdn.microsoft.com/en-us/library/windows/desktop/ee418864%28v=vs.85%29.aspx#WM_INPUT
|
||||
UINT dwSize = sizeof(RAWINPUT);
|
||||
static BYTE lpb[sizeof(RAWINPUT)];
|
||||
GetRawInputData((HRAWINPUT)lParam, RID_INPUT,
|
||||
lpb, &dwSize, sizeof(RAWINPUTHEADER));
|
||||
RAWINPUT* raw = (RAWINPUT*)lpb;
|
||||
if (raw->header.dwType == RIM_TYPEMOUSE)
|
||||
{
|
||||
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, lpb, &dwSize, sizeof(RAWINPUTHEADER));
|
||||
RAWINPUT *raw = (RAWINPUT *)lpb;
|
||||
if (raw->header.dwType == RIM_TYPEMOUSE) {
|
||||
int xPosRelative = raw->data.mouse.lLastX;
|
||||
int yPosRelative = raw->data.mouse.lLastY;
|
||||
if (xPosRelative||yPosRelative) qb64_custom_event(QB64_EVENT_RELATIVE_MOUSE_MOVEMENT,xPosRelative,yPosRelative,0,0,0,0,0,0,NULL,NULL);
|
||||
if (xPosRelative || yPosRelative)
|
||||
qb64_custom_event(QB64_EVENT_RELATIVE_MOUSE_MOVEMENT, xPosRelative, yPosRelative, 0, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
case WM_MOUSEMOVE: {
|
||||
|
||||
|
||||
|
||||
if (!raw_setup){
|
||||
raw_setup=1;
|
||||
#ifndef HID_USAGE_PAGE_GENERIC
|
||||
#define HID_USAGE_PAGE_GENERIC ((USHORT) 0x01)
|
||||
#endif
|
||||
#ifndef HID_USAGE_GENERIC_MOUSE
|
||||
#define HID_USAGE_GENERIC_MOUSE ((USHORT) 0x02)
|
||||
#endif
|
||||
if (!raw_setup) {
|
||||
raw_setup = 1;
|
||||
# ifndef HID_USAGE_PAGE_GENERIC
|
||||
# define HID_USAGE_PAGE_GENERIC ((USHORT)0x01)
|
||||
# endif
|
||||
# ifndef HID_USAGE_GENERIC_MOUSE
|
||||
# define HID_USAGE_GENERIC_MOUSE ((USHORT)0x02)
|
||||
# endif
|
||||
Rid[0].usUsagePage = HID_USAGE_PAGE_GENERIC;
|
||||
Rid[0].usUsage = HID_USAGE_GENERIC_MOUSE;
|
||||
Rid[0].dwFlags = RIDEV_INPUTSINK;
|
||||
|
@ -2291,9 +1989,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
|||
RegisterRawInputDevices(Rid, 1, sizeof(Rid[0]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
# if defined(_WIN32_WCE)
|
||||
window->State.MouseX = 320-HIWORD( lParam );
|
||||
window->State.MouseY = LOWORD( lParam );
|
||||
#else
|
||||
|
@ -2324,8 +2020,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
|||
window->State.MouseY ) );
|
||||
|
||||
fgState.Modifiers = INVALID_MODIFIERS;
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_MBUTTONDOWN:
|
||||
|
@ -2507,17 +2202,15 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
|||
case WM_SYSKEYDOWN:
|
||||
case WM_KEYDOWN:
|
||||
{
|
||||
|
||||
//QB64
|
||||
if (wParam==VK_PAUSE){
|
||||
qb64_custom_event(QB64_EVENT_KEY,VK+QBVK_PAUSE,1,0,0,0,0,0,0,NULL,NULL);
|
||||
// QB64
|
||||
if (wParam == VK_PAUSE) {
|
||||
qb64_custom_event(QB64_EVENT_KEY, VK + QBVK_PAUSE, 1, 0, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
if (wParam==VK_CANCEL){
|
||||
qb64_custom_event(QB64_EVENT_KEY,VK+QBVK_BREAK,1,0,0,0,0,0,0,NULL,NULL);
|
||||
}
|
||||
if (wParam == VK_CANCEL) {
|
||||
qb64_custom_event(QB64_EVENT_KEY, VK + QBVK_BREAK, 1, 0, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int keypress = -1;
|
||||
POINT mouse_pos ;
|
||||
|
@ -2612,19 +2305,15 @@ if (wParam==VK_CANCEL){
|
|||
case WM_SYSKEYUP:
|
||||
case WM_KEYUP:
|
||||
{
|
||||
|
||||
//QB64
|
||||
if (wParam==VK_PAUSE){
|
||||
qb64_custom_event(QB64_EVENT_KEY,VK+QBVK_PAUSE,-1,0,0,0,0,0,0,NULL,NULL);
|
||||
// QB64
|
||||
if (wParam == VK_PAUSE) {
|
||||
qb64_custom_event(QB64_EVENT_KEY, VK + QBVK_PAUSE, -1, 0, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
if (wParam==VK_CANCEL){
|
||||
qb64_custom_event(QB64_EVENT_KEY,VK+QBVK_BREAK,-1,0,0,0,0,0,0,NULL,NULL);
|
||||
}
|
||||
if (wParam == VK_CANCEL) {
|
||||
qb64_custom_event(QB64_EVENT_KEY, VK + QBVK_BREAK, -1, 0, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
int keypress = -1;
|
||||
POINT mouse_pos;
|
||||
|
@ -2709,8 +2398,7 @@ if (wParam==VK_CANCEL){
|
|||
);
|
||||
|
||||
fgState.Modifiers = INVALID_MODIFIERS;
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
|
||||
case WM_SYSCHAR:
|
||||
case WM_CHAR:
|
||||
|
@ -2915,11 +2603,10 @@ if (wParam==VK_CANCEL){
|
|||
break;
|
||||
}
|
||||
|
||||
qb64_os_event_info=2;
|
||||
qb64_os_event_return=qb64_os_event_windows(
|
||||
hWnd, uMsg, wParam,lParam, &qb64_os_event_info
|
||||
);
|
||||
if (qb64_os_event_info==3) return qb64_os_event_return;
|
||||
qb64_os_event_info = 2;
|
||||
qb64_os_event_return = qb64_os_event_windows(hWnd, uMsg, wParam, lParam, &qb64_os_event_info);
|
||||
if (qb64_os_event_info == 3)
|
||||
return qb64_os_event_return;
|
||||
|
||||
return lRet;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_menu.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_misc.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_overlay.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/* Spaceball support for Linux.
|
||||
* Written by John Tsiombikas <nuclear@member.fsf.org>
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_state.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_stroke_mono_roman.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_stroke_roman.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_structure.c
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/*
|
||||
* freeglut_videoresize.c
|
||||
*
|
||||
|
|
|
@ -1,20 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
|
||||
//QB64
|
||||
void QB64_Window_Handle(void *handle);
|
||||
|
||||
|
||||
int QB64_Resizable();
|
||||
/*
|
||||
changed:
|
||||
WS_OVERLAPPEDWINDOW
|
||||
...to...
|
||||
((WS_OVERLAPPEDWINDOW*QB64_Resizable())|WS_DLGFRAME|WS_BORDER|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX)
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* freeglut_window.c
|
||||
*
|
||||
|
@ -42,6 +25,17 @@ WS_OVERLAPPEDWINDOW
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// QB64
|
||||
void QB64_Window_Handle(void *handle);
|
||||
|
||||
int QB64_Resizable();
|
||||
/*
|
||||
changed:
|
||||
WS_OVERLAPPEDWINDOW
|
||||
...to...
|
||||
((WS_OVERLAPPEDWINDOW*QB64_Resizable())|WS_DLGFRAME|WS_BORDER|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX)
|
||||
*/
|
||||
|
||||
#define FREEGLUT_BUILDING_LIB
|
||||
#include <GL/freeglut.h>
|
||||
#include "freeglut_internal.h"
|
||||
|
@ -748,85 +742,13 @@ static void fghFillPixelFormatAttributes( int *attributes, const PIXELFORMATDESC
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
void alert(int x){
|
||||
static char str[100];
|
||||
memset(&str[0],0,100);
|
||||
sprintf(str, "%d", x);
|
||||
MessageBox(0,&str[0], "Alert", MB_OK );
|
||||
}
|
||||
*/
|
||||
|
||||
void alert(char *x){
|
||||
MessageBox(0,x, "Alert", MB_OK );
|
||||
}
|
||||
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
|
||||
int ChoosePixelFormatEx(HDC hdc,int *p_bpp,int *p_depth,int *p_dbl,int *p_acc)
|
||||
{ int wbpp; if (p_bpp==NULL) wbpp=-1; else wbpp=*p_bpp;
|
||||
int wdepth; if (p_depth==NULL) wdepth=16; else wdepth=*p_depth;
|
||||
int wdbl; if (p_dbl==NULL) wdbl=-1; else wdbl=*p_dbl;
|
||||
int wacc; if (p_acc==NULL) wacc=1; else wacc=*p_acc;
|
||||
ZeroMemory(&pfd,sizeof(pfd)); pfd.nSize=sizeof(pfd); pfd.nVersion=1;
|
||||
int num=DescribePixelFormat(hdc,1,sizeof(pfd),&pfd);
|
||||
if (num==0) return 0;
|
||||
unsigned int maxqual=0; int maxindex=0;
|
||||
int max_bpp, max_depth, max_dbl, max_acc;
|
||||
int i;
|
||||
for (i=1; i<=num; i++)
|
||||
{ ZeroMemory(&pfd,sizeof(pfd)); pfd.nSize=sizeof(pfd); pfd.nVersion=1;
|
||||
DescribePixelFormat(hdc,i,sizeof(pfd),&pfd);
|
||||
int bpp=pfd.cColorBits;
|
||||
int depth=pfd.cDepthBits;
|
||||
int pal=(pfd.iPixelType==PFD_TYPE_COLORINDEX);
|
||||
int mcd=((pfd.dwFlags & PFD_GENERIC_FORMAT) && (pfd.dwFlags & PFD_GENERIC_ACCELERATED));
|
||||
|
||||
//if (pfd.dwFlags & PFD_GENERIC_ACCELERATED) alert ("SHEEP!");
|
||||
//alert ("SHEEPzzz!");
|
||||
|
||||
int soft=((pfd.dwFlags & PFD_GENERIC_FORMAT) && !(pfd.dwFlags & PFD_GENERIC_ACCELERATED));
|
||||
int icd=(!(pfd.dwFlags & PFD_GENERIC_FORMAT) && !(pfd.dwFlags & PFD_GENERIC_ACCELERATED));
|
||||
|
||||
//if (icd) alert("icd");
|
||||
|
||||
int opengl=(pfd.dwFlags & PFD_SUPPORT_OPENGL);
|
||||
int window=(pfd.dwFlags & PFD_DRAW_TO_WINDOW);
|
||||
int bitmap=(pfd.dwFlags & PFD_DRAW_TO_BITMAP);
|
||||
int dbuff=(pfd.dwFlags & PFD_DOUBLEBUFFER);
|
||||
//
|
||||
unsigned int q=0;
|
||||
if (opengl && window) q=q+0x8000;
|
||||
if (wdepth==-1 || (wdepth>0 && depth>0)) q=q+0x4000;
|
||||
if (wdbl==-1 || (wdbl==0 && !dbuff) || (wdbl==1 && dbuff)) q=q+0x2000;
|
||||
if (wacc==-1 || (wacc==0 && soft) || (wacc==1 && (mcd || icd))) q=q+0x1000;
|
||||
if (mcd || icd) q=q+0x0040; if (icd) q=q+0x0002;
|
||||
if (wbpp==-1 || (wbpp==bpp)) q=q+0x0800;
|
||||
if (bpp>=16) q=q+0x0020; if (bpp==16) q=q+0x0008;
|
||||
if (wdepth==-1 || (wdepth==depth)) q=q+0x0400;
|
||||
if (depth>=16) q=q+0x0010; if (depth==16) q=q+0x0004;
|
||||
if (!pal) q=q+0x0080;
|
||||
if (bitmap) q=q+0x0001;
|
||||
if (q>maxqual) {maxqual=q; maxindex=i;max_bpp=bpp; max_depth=depth; max_dbl=dbuff?1:0; max_acc=soft?0:1;}
|
||||
}
|
||||
if (maxindex==0) return maxindex;
|
||||
if (p_bpp!=NULL) *p_bpp=max_bpp;
|
||||
if (p_depth!=NULL) *p_depth=max_depth;
|
||||
if (p_dbl!=NULL) *p_dbl=max_dbl;
|
||||
if (p_acc!=NULL) *p_acc=max_acc;
|
||||
DescribePixelFormat(hdc,maxindex,sizeof(pfd),&pfd);
|
||||
return maxindex;
|
||||
}
|
||||
|
||||
|
||||
GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
|
||||
unsigned char layer_type )
|
||||
{
|
||||
#if defined(_WIN32_WCE)
|
||||
return GL_TRUE;
|
||||
#else
|
||||
////PIXELFORMATDESCRIPTOR pfd;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
PIXELFORMATDESCRIPTOR* ppfd = &pfd;
|
||||
int pixelformat;
|
||||
HDC current_hDC;
|
||||
|
@ -839,43 +761,8 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
|
|||
|
||||
fghFillPFD( ppfd, current_hDC, layer_type );
|
||||
|
||||
//pfd.dwFlags|=PFD_SUPPORT_OPENGL;
|
||||
|
||||
|
||||
//pfd.dwFlags
|
||||
|
||||
pixelformat = ChoosePixelFormat( current_hDC, ppfd );
|
||||
|
||||
// int icd=(!(pfd.dwFlags & PFD_GENERIC_FORMAT) && !(pfd.dwFlags & PFD_GENERIC_ACCELERATED));
|
||||
// if (icd) alert("icd");
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
int bpp2=-1; // don't care. (or a positive integer)
|
||||
int depth2=-1; // don't care. (or a positive integer)
|
||||
int dbl2=1; // we want double-buffering. (or -1 for 'don't care', or 0 for 'none')
|
||||
int acc2=1; // we want acceleration. (or -1 or 0)
|
||||
*/
|
||||
|
||||
// hWnd = CreateWindow("OpenGL", title, WS_OVERLAPPEDWINDOW |
|
||||
// WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
// x, y, width, height, NULL, NULL, hInstance, NULL);
|
||||
|
||||
|
||||
// HWND hWndx=CreateWindow(_T("FREEGLUT_dummy2"), _T(""), WS_OVERLAPPEDWINDOW , 0,0,800,600, 0, 0, fgDisplay.Instance, 0 );
|
||||
// current_hDC=GetDC(hWndx);
|
||||
|
||||
|
||||
// pixelformat=ChoosePixelFormatEx(current_hDC,&bpp2,&depth2,&dbl2,&acc2);
|
||||
/*
|
||||
if (pfd.dwFlags&PFD_SUPPORT_OPENGL) alert("HIPPO!");
|
||||
if (pfd.dwFlags&PFD_GENERIC_ACCELERATED) alert("cheetah!");
|
||||
if (pixelformat==0) alert("noooo!");
|
||||
if (acc2) alert("acc!");
|
||||
*/
|
||||
|
||||
/* windows hack for multismapling/sRGB */
|
||||
if ( ( fgState.DisplayMode & GLUT_MULTISAMPLE ) ||
|
||||
( fgState.DisplayMode & GLUT_SRGB ) )
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef FREEGLUT_STATIC
|
||||
#define FREEGLUT_STATIC
|
||||
#endif
|
||||
/* Written for XI1 by Nikolas Doerfler <doerflen@in.tum.de> (c) 2008 *
|
||||
* Rewritten for XI2 by Florian Echtler <echtler@in.tum.de> (c) 2009 */
|
||||
|
||||
|
|
Loading…
Reference in a new issue