|
@@ -21,1081 +21,360 @@
|
|
|
* 3. This notice may not be removed or altered from any
|
|
|
* source distribution.
|
|
|
|
|
|
- !!! modification from Serge 26.02.2022
|
|
|
+ !!! modification from Serge 02.05.2022
|
|
|
}
|
|
|
-unit zgl_screen;
|
|
|
+unit zgl_types;
|
|
|
|
|
|
{$I zgl_config.cfg}
|
|
|
-{$I GLdefine.cfg}
|
|
|
-
|
|
|
-{$IF defined(iOS) or defined(MAC_COCOA)}
|
|
|
- {$modeswitch objectivec1}
|
|
|
-{$IfEnd}
|
|
|
|
|
|
interface
|
|
|
|
|
|
-uses
|
|
|
-{$IFDEF USE_X11}
|
|
|
- X, XLib, XRandr, UnixType,
|
|
|
- {$IfNDef USE_GLES}
|
|
|
- zgl_glx_wgl,
|
|
|
- {$EndIf}
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF WINDOWS}
|
|
|
- Windows,
|
|
|
- zgl_glx_wgl,
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF MACOSX}{$IfDef MAC_COCOA}
|
|
|
- CocoaAll,
|
|
|
-{$EndIf}
|
|
|
- MacOSAll,
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF iOS}
|
|
|
- iPhoneAll, CFBase, CFString,
|
|
|
-{$ENDIF}
|
|
|
-
|
|
|
- zgl_types;
|
|
|
-
|
|
|
const
|
|
|
- REFRESH_MAXIMUM = 0;
|
|
|
- REFRESH_DEFAULT = 1;
|
|
|
-
|
|
|
-var
|
|
|
- SetViewPort: procedure;
|
|
|
-
|
|
|
-{$IfNDef ANDROID}
|
|
|
-// Rus: инициализация окна.
|
|
|
-// Eng: window initialization.
|
|
|
-procedure scr_Init;
|
|
|
-{$IfNDef MAC_COCOA}
|
|
|
-// Rus: сбросить настройки окна в исходное состояние.
|
|
|
-// Eng: reset the window settings to their original state.
|
|
|
-procedure scr_Reset;
|
|
|
-{$EndIf}
|
|
|
-// Rus: создание окна.
|
|
|
-// Eng: window creation.
|
|
|
-function scr_Create: Boolean;
|
|
|
-// Rus: уничтожение окна.
|
|
|
-// Eng: window destruction.
|
|
|
-procedure scr_Destroy;
|
|
|
-{$EndIf}
|
|
|
-
|
|
|
-// Rus: очистка окна.
|
|
|
-// Eng: window cleaning.
|
|
|
-procedure scr_Clear;
|
|
|
-// Rus:
|
|
|
-// Eng:
|
|
|
-procedure scr_Flush;
|
|
|
-
|
|
|
-// Rus: установка заданных значений окна. Значения заданы посредством
|
|
|
-// zgl_SetParam или по умолчанию.
|
|
|
-// Eng: setting window preset values. Values are set via zgl_SetParam or by default.
|
|
|
-function scr_SetOptions(): Boolean;
|
|
|
-// Rus: корректировка окна вывода заданным значениям.
|
|
|
-// Eng: adjustment of the output window to the given values.
|
|
|
-procedure scr_CorrectResolution(Width, Height: Word);
|
|
|
-// Rus: установка порта вывода. На данное время только 2D.
|
|
|
-// Eng: setting the output port. Currently only 2D.
|
|
|
-procedure scr_SetViewPort2D;
|
|
|
-// Rus: включение/выключение вертикальной синхронизации.
|
|
|
-// Eng: enable/disable vertical sync.
|
|
|
-procedure scr_SetVSync(WSync: Boolean);
|
|
|
-// Rus: включение/выключение очистки окна заданным цветом и установка цвета
|
|
|
-// очистки. RGB, A = 255;
|
|
|
-// Eng: enable/disable window cleaning with a specified color and set the
|
|
|
-// cleaning color. RGB, A=255;
|
|
|
-procedure scr_SetClearColor(flag: Boolean = true; Color: Cardinal = 0);
|
|
|
-// Rus: процедура вертикальной синхронизации. Вызывать не надо, происходит по
|
|
|
-// умолчанию, если включена вертикальная синхронизация.
|
|
|
-// Eng: vertical synchronization procedure. Don't call, happens by default if
|
|
|
-// vertical sync is enabled.
|
|
|
-procedure scr_VSync;
|
|
|
-{$IfNDef USE_INIT_HANDLE}
|
|
|
-// Rus: установка FPS. Требуется доработка на проверку частот монитора.
|
|
|
-// Eng: FPS setting. Improvement is required to check the frequencies of the monitor.
|
|
|
-procedure scr_SetFPS(FPS: LongWord);
|
|
|
-{$EndIf}
|
|
|
-
|
|
|
-//procedure scr_SetFSAA(FSAA: Byte);
|
|
|
-
|
|
|
-// Rus: Чтение определённой области окна в память.
|
|
|
-// Eng: Reading a specific region of a window into memory.
|
|
|
-procedure scr_ReadPixels(var pData: Pointer; X, Y, Width, Height: Word);
|
|
|
-{$IfNDef ANDROID}
|
|
|
-// на данное время ни где не используется, кроме инициализации. Нужен будет
|
|
|
-// выводимый список всех возможных разрешений экрана?
|
|
|
-//procedure scr_GetResList;
|
|
|
-{$EndIf}
|
|
|
-// Rus: установка глубины для 2D режима. Можно использовать и для 3D, учитывая,
|
|
|
-// что Far не должно быть меньше нуля.
|
|
|
-// Eng: depth setting for 2D mode. Can be used for 3D as well, given that Far
|
|
|
-// must not be less than zero.
|
|
|
-procedure Set2DNearFar(newNear, newFar: {$IfNDef USE_GLES}Double{$Else}{$IF DEFINED(USE_GLES_ON_DESKTOP) and DEFINED(USE_AMD_DRIVERS)}Double{$Else}Single{$IfEnd}{$EndIf});
|
|
|
-{$IfDef GL_VERSION_3_0}
|
|
|
-// Rus: установка версии OpenGL, маски и флагов. Вызывать обязательно до
|
|
|
-// создания окна (до zgl_Init)!!! Совместимые версии только до OpenGL 3.1,
|
|
|
-// далее они не совместимы со старым контекстом.
|
|
|
-// Eng:
|
|
|
-procedure SetGLVersionAndFlags({$IfNDef MAC_COCOA}major, minor: Integer; flag: LongWord = COMPATIBILITY_VERSION{$Else}mode: LongWord{$EndIf});
|
|
|
-{$EndIf}
|
|
|
-
|
|
|
-type
|
|
|
- zglPResolutionList = ^zglTResolutionList;
|
|
|
- zglTResolutionList = record
|
|
|
- Count : Integer;
|
|
|
- Width : array of Integer;
|
|
|
- Height: array of Integer;
|
|
|
- {$ifdef Windows}
|
|
|
- frequency: array of Integer;
|
|
|
- {$endif}
|
|
|
- end;
|
|
|
-
|
|
|
-{$IFDEF WINDOWS}
|
|
|
-type
|
|
|
- HMONITOR = THandle;
|
|
|
- MONITORINFOEX = record // inormation monitor
|
|
|
- cbSize : LongWord;
|
|
|
- rcMonitor: TRect;
|
|
|
- rcWork : TRect;
|
|
|
- dwFlags : LongWord;
|
|
|
- szDevice : array[0..CCHDEVICENAME - 1] of WideChar;
|
|
|
- end;
|
|
|
-{$ENDIF}
|
|
|
-
|
|
|
-var
|
|
|
- scrRefresh : Integer = REFRESH_MAXIMUM;
|
|
|
- scrVSync : Boolean = false;
|
|
|
- {$IfNDef ANDROID}
|
|
|
- scrResList : zglTResolutionList;
|
|
|
- scrInitialized: Boolean;
|
|
|
- {$EndIf}
|
|
|
-
|
|
|
- // Viewport
|
|
|
- scrViewportX: Integer;
|
|
|
- scrViewportY: Integer;
|
|
|
- scrViewportW: Integer;
|
|
|
- scrViewportH: Integer;
|
|
|
-
|
|
|
- // Resolution Correct
|
|
|
- scrResW : Integer;
|
|
|
- scrResH : Integer;
|
|
|
- scrResCX: Single = 1;
|
|
|
- scrResCY: Single = 1;
|
|
|
- scrAddCX: Integer = 0;
|
|
|
- scrAddCY: Integer = 0;
|
|
|
- scrSubCX: Integer = 0;
|
|
|
- scrSubCY: Integer = 0;
|
|
|
-
|
|
|
-
|
|
|
- scrViewPort : Boolean = True; // этот флаг можно отключать, если мы не меняем поле прорисовки.
|
|
|
- scrClearColor : Boolean = True;
|
|
|
- scr_UseClearColor : zglTColor;
|
|
|
-
|
|
|
- {$IFDEF USE_X11}
|
|
|
- scrDisplay : PDisplay;
|
|
|
- scrDefault : cint;
|
|
|
- scrSettings : Pointer;
|
|
|
- scrDesktop : LongInt;
|
|
|
- scrCurrent : LongInt;
|
|
|
- scrModeCount: LongInt;
|
|
|
- scrModeList : PXRRScreenSize;
|
|
|
- scrEventBase: cint;
|
|
|
- scrErrorBase: cint;
|
|
|
- scrRotation : Word;
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF WINDOWS}
|
|
|
- scrSettings: DEVMODEW;
|
|
|
- scrDesktop : DEVMODEW;
|
|
|
- scrMonInfo : MONITORINFOEX;
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF MACOSX}
|
|
|
- scrDisplay : CGDirectDisplayID;
|
|
|
- scrDesktop : {$IfDef MAC_COCOA}CGDisplayModeRef{$Else} CFDictionaryRef{$EndIf};
|
|
|
- scrDesktopW : Integer;
|
|
|
- scrDesktopH : Integer;
|
|
|
- scrSettings : CFDictionaryRef;
|
|
|
- scrModeCount: CFIndex;
|
|
|
- scrModeList : CFArrayRef;
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF iOS}
|
|
|
- scrDisplayLink : CADisplayLink;
|
|
|
- scrCurrModeW : Integer;
|
|
|
- scrCurrModeH : Integer;
|
|
|
- scrDesktopW : Integer;
|
|
|
- scrDesktopH : Integer;
|
|
|
- scrOrientation : UIInterfaceOrientation;
|
|
|
- scrCanLandscape: Boolean;
|
|
|
- scrCanPortrait : Boolean;
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF ANDROID}
|
|
|
- scrDesktopW: Integer;
|
|
|
- scrDesktopH: Integer;
|
|
|
- {$ENDIF}
|
|
|
- {$IfNDef USE_GLES}
|
|
|
- scrFar: Double = 1;
|
|
|
- scrNear: Double = - 1;
|
|
|
+// mouse and touch
|
|
|
+ is_down = $001; // нажато в данный момент времени
|
|
|
+ is_up = $002; // отпущено в данный момент времени
|
|
|
+ is_Press = $004; // нажато постоянно
|
|
|
+ is_canPress = $008; // отпущенно - по умолчанию
|
|
|
+ is_DoubleDown = $010; // было произведено двойное нажатие
|
|
|
+ is_TripleDown = $020; // тройное нажатие, нужно или нет?
|
|
|
+ is_mWheelUp = $040; // только для третьей кнопки мыши! - ролик (центральная кнопка)
|
|
|
+ is_mWheelDown = $080; // указание ролик движется вверх или вниз.
|
|
|
+ is_notTouch = $FF; // не было ни каких нажатий клавиши на виртуальной клавиатуре.
|
|
|
+
|
|
|
+ M_BLEFT = 0;
|
|
|
+ {$IfNDef MOBILE}
|
|
|
+ M_BMIDDLE = 1;
|
|
|
+ M_BRIGHT = 2;
|
|
|
{$Else}
|
|
|
- {$IF DEFINED(USE_GLES_ON_DESKTOP) and DEFINED(USE_AMD_DRIVERS)}
|
|
|
- scrFar: Double = 1;
|
|
|
- scrNear: Double = - 1;
|
|
|
- {$Else}
|
|
|
- scrFar: Single = 1;
|
|
|
- scrNear: Single = - 1;
|
|
|
- {$IfEnd}
|
|
|
+ M_BMIDDLE = 2;
|
|
|
+ M_BRIGHT = 1;
|
|
|
{$EndIf}
|
|
|
+ MAX_TOUCH = 10;
|
|
|
|
|
|
-
|
|
|
-implementation
|
|
|
-uses
|
|
|
- zgl_application,
|
|
|
- zgl_window,
|
|
|
- zgl_gltypeconst,
|
|
|
- {$IFNDEF USE_GLES}
|
|
|
- zgl_opengl,
|
|
|
- zgl_opengl_all,
|
|
|
- {$ELSE}
|
|
|
- zgl_opengles,
|
|
|
- zgl_opengles_all,
|
|
|
- {$ENDIF}
|
|
|
- zgl_render,
|
|
|
- zgl_render_2d,
|
|
|
- zgl_camera_2d,
|
|
|
- zgl_log,
|
|
|
- {$IfDef USE_VKEYBOARD}
|
|
|
- gegl_menu_gui,
|
|
|
+ // OpenGL
|
|
|
+ ModeUser = 1; // MatrixMode
|
|
|
+ Mode2D = 2;
|
|
|
+ Mode3D = 3;
|
|
|
+ {$IfDef MACOSX}
|
|
|
+ CORE_2_1 = 1;
|
|
|
+ CORE_3_2 = 2;
|
|
|
+ CORE_4_1 = 3;
|
|
|
{$EndIf}
|
|
|
- zgl_utils
|
|
|
- ;
|
|
|
+ CORE_VERSION = 1; // совместимость с текущей версией и выше
|
|
|
+ COMPATIBILITY_VERSION = 2; // совместимость с ранними версиями. Нельзя использовать для GL 3.2
|
|
|
+ GL_DEBUG = 4; // отладка контекста включена
|
|
|
+ GL_FORWARD_COMPATIBLE = 8; // вперёд совместимый контекст.
|
|
|
|
|
|
-{$IFDEF USE_X11}
|
|
|
-function XOpenIM(para1:PDisplay; para2:PXrmHashBucketRec; para3:PAnsiChar; para4:Pchar):PXIM;cdecl;external;
|
|
|
-function XCloseIM(im: PXIM): TStatus;cdecl;external;
|
|
|
-function XCreateIC(para1: PXIM; para2: array of const):PXIC;cdecl;external;
|
|
|
-procedure XDestroyIC(ic: PXIC);cdecl;external;
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF WINDOWS}
|
|
|
-const
|
|
|
- MONITOR_DEFAULTTOPRIMARY = $00000001;
|
|
|
-function MonitorFromWindow(hwnd: HWND; dwFlags: LongWord): THandle; stdcall; external 'user32.dll';
|
|
|
-function GetMonitorInfoW(monitor: HMONITOR; var moninfo: MONITORINFOEX): BOOL; stdcall; external 'user32.dll';
|
|
|
+{$IFNDEF FPC}
|
|
|
+type
|
|
|
+ QWORD = UInt64;
|
|
|
{$ENDIF}
|
|
|
|
|
|
-{$IfNDef ANDROID}
|
|
|
-procedure scr_GetResList;
|
|
|
-var
|
|
|
- i: Integer;
|
|
|
- {$IFDEF USE_X11}
|
|
|
- tmpSettings: PXRRScreenSize;
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF WINDOWS}
|
|
|
- tmpSettings: DEVMODEW;
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF MACOSX}
|
|
|
- tmpSettings : UnivPtr;
|
|
|
- width, height: Integer;
|
|
|
-
|
|
|
- {$ENDIF}
|
|
|
- function Already(Width, Height: Integer): Boolean;
|
|
|
- var
|
|
|
- j: Integer;
|
|
|
- begin
|
|
|
- Result := FALSE;
|
|
|
- for j := 0 to scrResList.Count - 1 do
|
|
|
- if (scrResList.Width[j] = Width) and (scrResList.Height[j] = Height) Then Result := TRUE;
|
|
|
- end;
|
|
|
-begin
|
|
|
-{$IFDEF USE_X11}
|
|
|
- tmpSettings := scrModeList;
|
|
|
- for i := 0 to scrModeCount - 1 do
|
|
|
- begin
|
|
|
- if not Already(tmpSettings.Width, tmpSettings.Height) Then
|
|
|
- begin
|
|
|
- INC(scrResList.Count);
|
|
|
- SetLength(scrResList.Width, scrResList.Count);
|
|
|
- SetLength(scrResList.Height, scrResList.Count);
|
|
|
- scrResList.Width[scrResList.Count - 1] := tmpSettings.Width;
|
|
|
- scrResList.Height[scrResList.Count - 1] := tmpSettings.Height;
|
|
|
- end;
|
|
|
- INC(tmpSettings);
|
|
|
- end;
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF WINDOWS}
|
|
|
- i := 0;
|
|
|
- FillChar(tmpSettings, SizeOf(DEVMODEW), 0);
|
|
|
- tmpSettings.dmSize := SizeOf(DEVMODEW);
|
|
|
- while EnumDisplaySettingsW(scrMonInfo.szDevice, i, tmpSettings) <> FALSE do
|
|
|
- begin
|
|
|
- if not Already(tmpSettings.dmPelsWidth, tmpSettings.dmPelsHeight) Then
|
|
|
- begin
|
|
|
- INC(scrResList.Count);
|
|
|
- SetLength(scrResList.Width, scrResList.Count);
|
|
|
- SetLength(scrResList.Height, scrResList.Count);
|
|
|
- SetLength(scrResList.frequency, scrResList.Count);
|
|
|
- scrResList.Width[scrResList.Count - 1] := tmpSettings.dmPelsWidth;
|
|
|
- scrResList.Height[scrResList.Count - 1] := tmpSettings.dmPelsHeight;
|
|
|
- scrResList.frequency[scrResList.Count - 1] := tmpSettings.dmDisplayFrequency;
|
|
|
- end;
|
|
|
- INC(i);
|
|
|
+type
|
|
|
+ Ptr = {$IFDEF CPU64} QWORD {$ELSE} LongWord {$ENDIF};
|
|
|
+
|
|
|
+ // Rus: указатель на массив байт.
|
|
|
+ // Eng: pointer to an array of bytes.
|
|
|
+ PByteArray = ^TByteArray;
|
|
|
+ // Rus: массив байт.
|
|
|
+ // Eng: array of bytes.
|
|
|
+ TByteArray = array[0..High(LongWord) shr 1 - 1] of Byte;
|
|
|
+ // Rus: указатель на массив слов.
|
|
|
+ // Eng: pointer to an array of words.
|
|
|
+ PWordArray = ^TWordArray;
|
|
|
+ // Rus: массив слов.
|
|
|
+ // Eng: array of words.
|
|
|
+ TWordArray = array[0..High(LongWord) shr 2 - 1] of Word;
|
|
|
+ // Rus: указатель на массив длинных слов.
|
|
|
+ // Eng: pointer to an array of long words.
|
|
|
+ PLongWordArray = ^TLongWordArray;
|
|
|
+ // Rus: массив длинных слов.
|
|
|
+ // Eng: array of long words.
|
|
|
+ TLongWordArray = array[0..High(LongWord) shr 3 - 1] of LongWord;
|
|
|
+
|
|
|
+ // Rus: указатель на индексы координат текстур.
|
|
|
+ // Eng: pointer to texture coordinate indices.
|
|
|
+ zglPTexCoordIndex = ^zglTTexCoordIndex;
|
|
|
+ // Rus: индексы координат текстур.
|
|
|
+ // Eng: texture coordinate indexes.
|
|
|
+ zglTTexCoordIndex = array[0..3] of Integer;
|
|
|
+
|
|
|
+ // Rus: указатель на список строк.
|
|
|
+ // Eng: a pointer to a list of strings.
|
|
|
+ zglPStringList = ^zglTStringList;
|
|
|
+ // Rus: список строк.
|
|
|
+ // Eng: string list.
|
|
|
+ zglTStringList = record
|
|
|
+ Count: Integer;
|
|
|
+ Items: array of UTF8String;
|
|
|
end;
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF MACOSX}
|
|
|
- tmpSettings := scrModeList;
|
|
|
- for i := 0 to scrModeCount - 1 do
|
|
|
- begin
|
|
|
- tmpSettings := CFArrayGetValueAtIndex(scrModeList, i);
|
|
|
|
|
|
- CFNumberGetValue(CFDictionaryGetValue(tmpSettings, CFSTRP('Width')), kCFNumberIntType, @width);
|
|
|
- CFNumberGetValue(CFDictionaryGetValue(tmpSettings, CFSTRP('Height')), kCFNumberIntType, @height);
|
|
|
- if not Already(width, height) Then
|
|
|
- begin
|
|
|
- INC(scrResList.Count);
|
|
|
- SetLength(scrResList.Width, scrResList.Count);
|
|
|
- SetLength(scrResList.Height, scrResList.Count);
|
|
|
- scrResList.Width[scrResList.Count - 1] := width;
|
|
|
- scrResList.Height[scrResList.Count - 1] := height;
|
|
|
- end;
|
|
|
+ // Rus: указатель на цвет в "точной" форме - RGBA - single. От 0 до 1.
|
|
|
+ // Eng: pointer to color in "exact" form - RGBA - single. 0 to 1.
|
|
|
+ zglPColor = ^zglTColor;
|
|
|
+ // Rus: цвет в "точной" форме - RGBA - single. От 0 до 1.
|
|
|
+ // Eng: color in "exact" form - RGBA - single. 0 to 1.
|
|
|
+ zglTColor = record
|
|
|
+ R, G, B, A: Single;
|
|
|
end;
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF iOS}
|
|
|
- scrResList.Count := 1;
|
|
|
- SetLength(scrResList.Width, 1);
|
|
|
- SetLength(scrResList.Height, 1);
|
|
|
- scrResList.Width[0] := scrDesktopW;
|
|
|
- scrResList.Height[0] := scrDesktopH;
|
|
|
-{$ENDIF}
|
|
|
-end;
|
|
|
-
|
|
|
-procedure scr_Init;
|
|
|
- {$IFDEF iOS}
|
|
|
- var
|
|
|
- i : Integer;
|
|
|
- orientations: NSArray;
|
|
|
- tmp : array[0..255] of AnsiChar;
|
|
|
- {$ENDIF}
|
|
|
- {$ifdef windows}
|
|
|
- var
|
|
|
- scrMonitor: THandle;
|
|
|
- i: Integer;
|
|
|
- {$endif}
|
|
|
-begin
|
|
|
-{$IFDEF USE_X11}
|
|
|
- if not appInitialized Then
|
|
|
- begin
|
|
|
- log_Init();
|
|
|
|
|
|
- if Assigned(scrDisplay) Then
|
|
|
- XCloseDisplay(scrDisplay);
|
|
|
-
|
|
|
- scrDisplay := XOpenDisplay(nil);
|
|
|
- if not Assigned(scrDisplay) Then
|
|
|
- begin
|
|
|
- u_Error('Cannot connect to X server.');
|
|
|
- exit;
|
|
|
- end;
|
|
|
-
|
|
|
- scrDefault := DefaultScreen(scrDisplay);
|
|
|
- wndRoot := DefaultRootWindow(scrDisplay);
|
|
|
-
|
|
|
- XRRSelectInput(scrDisplay, wndRoot, RRScreenChangeNotifyMask);
|
|
|
- XRRQueryExtension(scrDisplay, @scrEventBase, @scrErrorBase) ;
|
|
|
+ // Rus: указатель на цвет в байтах - RGBA.
|
|
|
+ // Eng: pointer to color in bytes - RGBA.
|
|
|
+ zglPByteColor = ^zglTByteColor;
|
|
|
+ // Rus: цвет в байтах - RGBA.
|
|
|
+ // Eng: color in bytes - RGBA.
|
|
|
+ zglTByteColor = record
|
|
|
+ R, G, B, A: Byte;
|
|
|
end;
|
|
|
|
|
|
- scrModeList := XRRSizes(scrDisplay, XRRRootToScreen(scrDisplay, wndRoot), @scrModeCount);
|
|
|
- scrSettings := XRRGetScreenInfo(scrDisplay, wndRoot);
|
|
|
- scrDesktop := XRRConfigCurrentConfiguration(scrSettings, @scrRotation);
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF WINDOWS}
|
|
|
- i := SizeOf(MONITORINFOEX);
|
|
|
- if scrMonInfo.cbSize <> i Then
|
|
|
- begin
|
|
|
- scrMonitor := MonitorFromWindow(wndHandle, MONITOR_DEFAULTTOPRIMARY);
|
|
|
- FillChar(scrMonInfo, i, 0);
|
|
|
- scrMonInfo.cbSize := i;
|
|
|
- GetMonitorInfoW(scrMonitor, scrMonInfo);
|
|
|
+// - было произведено нажатие-отжатие - эти события очищаются
|
|
|
+// - было произведено удержание - это событие не должно очищаться, пока не было нажатия или отжатия
|
|
|
+
|
|
|
+(*******************************************************************************
|
|
|
+* keyboard, mouse, touch and joystick& *
|
|
|
+*******************************************************************************)
|
|
|
+ // мы можем расширить структуру и реализовать множественные нажатия, аж до нескольких сотен
|
|
|
+ // но, для данного ввода, нам надо определить будет ли это эффективно
|
|
|
+ // проверяем это на мыши.
|
|
|
+
|
|
|
+ // Rus: для тачскрина, у каждого касания есть свои координаты.
|
|
|
+ // Eng: for a touchscreen, each touch has its own coordinates.
|
|
|
+ Pm_touch = ^m_touch;
|
|
|
+ m_touch = record
|
|
|
+ oldX, oldY, newX, newY: Integer; // старые и новые координаты, когда ведут по сенсору.
|
|
|
+// oldXtap, oldYtap: Integer; // последние координаты, которые были, до обнуления координат
|
|
|
+ state: LongWord;
|
|
|
+ DBLClickTime: Double;
|
|
|
end;
|
|
|
|
|
|
- i := SizeOf(DEVMODEW);
|
|
|
- FillChar(scrDesktop, i, 0);
|
|
|
- scrDesktop.dmSize := i;
|
|
|
- // Delphi: standard ENUM_REGISTRY_SETTINGS doesn't exist in Windows unit, no comments...
|
|
|
- EnumDisplaySettingsW(scrMonInfo.szDevice, LongWord(-2), scrDesktop);
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF MACOSX}
|
|
|
- scrDisplay := CGMainDisplayID();
|
|
|
- scrDesktop := {$IfNDef MAC_COCOA}CGDisplayCurrentMode(scrDisplay);{$Else}CGDisplayCopyDisplayMode(scrDisplay);{$EndIf}
|
|
|
- scrDesktopW := CGDisplayPixelsWide(scrDisplay);
|
|
|
- scrDesktopH := CGDisplayPixelsHigh(scrDisplay);
|
|
|
-
|
|
|
- scrModeList := {$IfNDef MAC_COCOA}CGDisplayAvailableModes(scrDisplay){$Else}CGDisplayCopyAllDisplayModes(scrDisplay, nil){$EndIf};
|
|
|
- scrModeCount := CFArrayGetCount(scrModeList);
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF iOS}
|
|
|
- if not appInitialized Then exit;
|
|
|
-
|
|
|
- app_InitPool();
|
|
|
-
|
|
|
- orientations := NSBundle.mainBundle.infoDictionary.objectForKey(utf8_GetNSString('UISupportedInterfaceOrientations'));
|
|
|
- for i := 0 to orientations.count() - 1 do
|
|
|
- begin
|
|
|
- CFStringGetCString(CFStringRef(orientations.objectAtIndex(i)), @tmp[0], 255, kCFStringEncodingUTF8);
|
|
|
- if (tmp = 'UIInterfaceOrientationLandscapeLeft') or (tmp = 'UIInterfaceOrientationLandscapeRight') Then
|
|
|
- scrCanLandscape := TRUE;
|
|
|
- if (tmp = 'UIInterfaceOrientationPortrait') or (tmp = 'UIInterfaceOrientationPortraitUpsideDown') Then
|
|
|
- scrCanPortrait := TRUE;
|
|
|
+ // Rus: для клавиш клавиатуры и мыши.
|
|
|
+ // Eng: for keyboard and mouse keys.
|
|
|
+ km_Button = record
|
|
|
+ state: LongWord;
|
|
|
+ DBLClickTime: Double;
|
|
|
end;
|
|
|
+(*******************************************************************************
|
|
|
+* End *
|
|
|
+*******************************************************************************)
|
|
|
|
|
|
- if UIDevice.currentDevice.systemVersion.floatValue >= 3.2 Then
|
|
|
- begin
|
|
|
- scrCurrModeW := Round(UIScreen.mainScreen.currentMode.size.width);
|
|
|
- scrCurrModeH := Round(UIScreen.mainScreen.currentMode.size.height);
|
|
|
-
|
|
|
- if (UIDevice.currentDevice.userInterfaceIdiom = UIUserInterfaceIdiomPhone) and (UIDevice.currentDevice.model.rangeOfString(utf8_GetNSString('iPad')).location <> NSNotFound) Then
|
|
|
- begin
|
|
|
- scrCurrModeW := Round(480 * UIScreen.mainScreen.scale);
|
|
|
- scrCurrModeH := Round(320 * UIScreen.mainScreen.scale);
|
|
|
- end;
|
|
|
- end else
|
|
|
- begin
|
|
|
- scrCurrModeW := Round(UIScreen.mainScreen.bounds.size.width);
|
|
|
- scrCurrModeH := Round(UIScreen.mainScreen.bounds.size.height);
|
|
|
+(*******************************************************************************
|
|
|
+* primitives *
|
|
|
+*******************************************************************************)
|
|
|
+type
|
|
|
+ // Rus: указатель на две координаты - X, Y и на цвет - Color точки.
|
|
|
+ // Eng: pointer to two coordinates - X, Y and color - Point color.
|
|
|
+ zglPPoint2DColor = ^zglTPoint2DColor;
|
|
|
+ // Rus: две координаты - X, Y и цвет точки - Color.
|
|
|
+ // Eng: two coordinates - X, Y and color of the point - Color.
|
|
|
+ zglTPoint2DColor = record
|
|
|
+ X, Y: Single;
|
|
|
+ Color: LongWord;
|
|
|
end;
|
|
|
|
|
|
- if (scrCurrModeW > scrCurrModeH) Then
|
|
|
- begin
|
|
|
- scrDesktopH := scrCurrModeW;
|
|
|
- scrCurrModeW := scrCurrModeH;
|
|
|
- scrCurrModeH := scrDesktopH;
|
|
|
+ // Rus: указатель на две координаты точки - X, Y.
|
|
|
+ // Eng: pointer to two point coordinates - X, Y.
|
|
|
+ zglPPoint2D = ^zglTPoint2D;
|
|
|
+ // Rus: две координаты точки - X, Y.
|
|
|
+ // Eng: two coordinates of a point - X, Y.
|
|
|
+ zglTPoint2D = record
|
|
|
+ X, Y: Single;
|
|
|
end;
|
|
|
|
|
|
- scrOrientation := UIApplication.sharedApplication.statusBarOrientation();
|
|
|
- if scrCanPortrait and ((scrOrientation = UIInterfaceOrientationPortrait) or (scrOrientation = UIInterfaceOrientationPortraitUpsideDown)) Then
|
|
|
- begin
|
|
|
- wndPortrait := TRUE;
|
|
|
- scrDesktopW := scrCurrModeW;
|
|
|
- scrDesktopH := scrCurrModeH;
|
|
|
- end else
|
|
|
- if scrCanLandscape and ((scrOrientation = UIInterfaceOrientationLandscapeLeft) or (scrOrientation = UIInterfaceOrientationLandscapeRight)) Then
|
|
|
- begin
|
|
|
- wndPortrait := FALSE;
|
|
|
- scrDesktopW := scrCurrModeH;
|
|
|
- scrDesktopH := scrCurrModeW;
|
|
|
- end else
|
|
|
- begin
|
|
|
- wndPortrait := scrCanPortrait;
|
|
|
- scrDesktopW := scrCurrModeW;
|
|
|
- scrDesktopH := scrCurrModeH;
|
|
|
- end;
|
|
|
-
|
|
|
- oglWidth := scrDesktopW;
|
|
|
- oglHeight := scrDesktopH;
|
|
|
- oglTargetW := scrDesktopW;
|
|
|
- oglTargetH := scrDesktopH;
|
|
|
-{$ENDIF}
|
|
|
-{$IfNDef MAC_COCOA}
|
|
|
- scr_GetResList;
|
|
|
-{$EndIf}
|
|
|
- scrInitialized := TRUE;
|
|
|
-end;
|
|
|
-
|
|
|
-{$IfNDef MAC_COCOA}
|
|
|
-procedure scr_Reset;
|
|
|
-begin
|
|
|
-{$IFDEF USE_X11}
|
|
|
- XRRSetScreenConfig(scrDisplay, scrSettings, wndRoot, scrDesktop, scrRotation, CurrentTime);
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF WINDOWS}
|
|
|
- ChangeDisplaySettingsExW(scrMonInfo.szDevice, DEVMODEW(nil^), 0, CDS_FULLSCREEN, nil);
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF MACOSX}
|
|
|
- CGDisplaySwitchToMode(scrDisplay, scrDesktop);
|
|
|
- //CGDisplayRelease(scrDisplay);
|
|
|
-{$ENDIF}
|
|
|
-end;
|
|
|
-
|
|
|
-procedure scr_SetWindowedMode;
|
|
|
- {$IFDEF WINDOWS}
|
|
|
- var
|
|
|
- settings: DEVMODEW;
|
|
|
- {$ENDIF}
|
|
|
-begin
|
|
|
- {$IFDEF USE_X11}
|
|
|
- scr_Reset();
|
|
|
- XMapWindow(scrDisplay, wndHandle);
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF WINDOWS}
|
|
|
- if scrDesktop.dmBitsPerPel <> 32 Then
|
|
|
- begin
|
|
|
- settings := scrDesktop;
|
|
|
- settings.dmBitsPerPel := 32;
|
|
|
-
|
|
|
- if ChangeDisplaySettingsExW(scrMonInfo.szDevice, settings, 0, CDS_TEST, nil) <> DISP_CHANGE_SUCCESSFUL Then
|
|
|
- begin
|
|
|
- u_Error('Desktop doesn''t support 32-bit color mode.');
|
|
|
- winOn := FALSE;
|
|
|
- end else
|
|
|
- ChangeDisplaySettingsExW(scrMonInfo.szDevice, settings, 0, CDS_FULLSCREEN, nil);
|
|
|
-
|
|
|
- scrRefresh := scrDesktop.dmDisplayFrequency;
|
|
|
- end else
|
|
|
- scr_Reset();
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF MACOSX}
|
|
|
- scr_Reset();
|
|
|
- ShowMenuBar();
|
|
|
- {$ENDIF}
|
|
|
-end;
|
|
|
-{$EndIf}
|
|
|
-
|
|
|
-function scr_Create: Boolean;
|
|
|
-{$IfDef MAC_COCOA}
|
|
|
-var
|
|
|
- pool: NSAutoreleasePool;
|
|
|
- mainMenu: NSMenu;
|
|
|
-{$EndIf}
|
|
|
-begin
|
|
|
- {$IfNDef ANDROID}
|
|
|
- scr_Init();
|
|
|
- {$EndIf}
|
|
|
- {$IFDEF USE_X11}
|
|
|
- if DefaultDepth(scrDisplay, scrDefault) < 24 Then
|
|
|
- begin
|
|
|
- u_Error('DefaultDepth not set to 24-bit.');
|
|
|
- winOn := false;
|
|
|
- Result := FALSE;
|
|
|
- exit;
|
|
|
- end;
|
|
|
-
|
|
|
- {$IfDef OLD_METHODS}
|
|
|
- appXIM := XOpenIM(scrDisplay, nil, nil, nil);
|
|
|
- if not Assigned(appXIM) Then
|
|
|
- log_Add('XOpenIM - Fail')
|
|
|
- else
|
|
|
- log_Add('XOpenIM - ok');
|
|
|
-
|
|
|
- appXIC := XCreateIC(appXIM, [XNInputStyle, XIMPreeditNothing or XIMStatusNothing, 0]);
|
|
|
- if not Assigned(appXIC) Then
|
|
|
- log_Add('XCreateIC - Fail')
|
|
|
- else
|
|
|
- log_Add('XCreateIC - ok');
|
|
|
- {$EndIf}
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF WINDOWS}
|
|
|
- if (not wndFullScreen) and (scrDesktop.dmBitsPerPel <> 32) Then
|
|
|
- scr_SetWindowedMode();
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF MACOSX}{$IfDef MAC_COCOA}
|
|
|
- pool := NSAutoreleasePool.new;
|
|
|
- NSApp := NSApplication.sharedApplication;
|
|
|
- NSApp.setActivationPolicy(0);
|
|
|
- NSApp.activateIgnoringOtherApps(true);
|
|
|
-
|
|
|
- mainMenu := NSMenu.alloc.init.autorelease;
|
|
|
- NSApp.setMainMenu(mainMenu);
|
|
|
- mainMenu.setMenuBarVisible(false); // menu not visible
|
|
|
-
|
|
|
- pool.dealloc;
|
|
|
-
|
|
|
- {$Else}
|
|
|
- if CGDisplayBitsPerPixel(scrDisplay) <> 32 Then
|
|
|
- begin
|
|
|
- u_Error('Desktop not set to 32-bit mode.');
|
|
|
- winOn := False;
|
|
|
- Result := FALSE;
|
|
|
- exit;
|
|
|
- end;
|
|
|
- {$ENDIF}{$EndIf}
|
|
|
- log_Add('Current mode: ' + u_IntToStr(zgl_Get(DESKTOP_WIDTH)) + ' x ' + u_IntToStr(zgl_Get(DESKTOP_HEIGHT)));
|
|
|
- Result := TRUE;
|
|
|
-end;
|
|
|
-
|
|
|
-procedure scr_Destroy;
|
|
|
-begin
|
|
|
- {$IfNDef MAC_COCOA}
|
|
|
- if wndFullScreen Then
|
|
|
- scr_Reset();
|
|
|
- {$EndIf}
|
|
|
- {$IFDEF USE_X11}
|
|
|
- XRRFreeScreenConfigInfo(scrSettings);
|
|
|
- {$IfDef OLD_METHODS}
|
|
|
- XDestroyIC(appXIC);
|
|
|
- XCloseIM(appXIM);
|
|
|
- {$EndIf}
|
|
|
- {$ENDIF}
|
|
|
-
|
|
|
- scrResList.Count := 0;
|
|
|
- SetLength(scrResList.Width, 0);
|
|
|
- SetLength(scrResList.Height, 0);
|
|
|
- {$ifdef windows}
|
|
|
- SetLength(scrResList.frequency, 0);
|
|
|
- {$endif}
|
|
|
-
|
|
|
- scrInitialized := FALSE;
|
|
|
-end;
|
|
|
-{$EndIf}
|
|
|
-
|
|
|
-procedure scr_Clear;
|
|
|
-begin
|
|
|
- batch2d_Flush();
|
|
|
- if scrClearColor then
|
|
|
- glClearColor(scr_UseClearColor.R, scr_UseClearColor.G, scr_UseClearColor.b, scr_UseClearColor.A);
|
|
|
- glClear(GL_COLOR_BUFFER_BIT * Byte(appFlags and COLOR_BUFFER_CLEAR > 0) or GL_DEPTH_BUFFER_BIT * Byte(appFlags and DEPTH_BUFFER_CLEAR > 0) or
|
|
|
- GL_STENCIL_BUFFER_BIT * Byte(appFlags and STENCIL_BUFFER_CLEAR > 0));
|
|
|
-end;
|
|
|
-
|
|
|
-procedure scr_Flush;
|
|
|
-begin
|
|
|
- batch2d_Flush();
|
|
|
-{$IFNDEF USE_GLES}
|
|
|
- {$IFDEF LINUX}
|
|
|
- glXSwapBuffers(scrDisplay, wndHandle);
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF WINDOWS}
|
|
|
- SwapBuffers(wndDC);
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF MACOSX}{$IfDef MAC_COCOA}
|
|
|
- oglContext.flushBuffer;
|
|
|
- {$Else}
|
|
|
- aglSwapBuffers(oglContext);
|
|
|
- {$ENDIF}{$EndIf}
|
|
|
-{$ELSE}
|
|
|
- {$IFNDEF NO_EGL}
|
|
|
- eglSwapBuffers(oglDisplay, oglSurface);
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF iOS}
|
|
|
- eglContext.presentRenderbuffer(GL_RENDERBUFFER);
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF ANDROID}
|
|
|
- appEnv^.CallVoidMethod(appEnv, appObject, appSwapBuffers);
|
|
|
- {$ENDIF}
|
|
|
-{$ENDIF}
|
|
|
-end;
|
|
|
-
|
|
|
-function scr_SetOptions(): Boolean;
|
|
|
- {$IFDEF USE_X11}
|
|
|
- var
|
|
|
- modeToSet: Integer;
|
|
|
- mode : PXRRScreenSize;
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF WINDOWS}
|
|
|
- var
|
|
|
- i: Integer;
|
|
|
- r: Integer;
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF MACOSX}
|
|
|
- var
|
|
|
- b: Integer;
|
|
|
- {$ENDIF}
|
|
|
-begin
|
|
|
-{$IF DEFINED(iOS) or DEFINED(ANDROID)}
|
|
|
- wndWidth := scrDesktopW;
|
|
|
- wndHeight := scrDesktopH;
|
|
|
- scrRefresh := REFRESH_DEFAULT;
|
|
|
- wndFullScreen := TRUE;
|
|
|
- scrVsync := TRUE;
|
|
|
-{$IFEND}
|
|
|
- {$IfDef USE_VKEYBOARD}
|
|
|
- _wndWidth := wndWidth;
|
|
|
- _wndHeight := wndHeight;
|
|
|
- {$EndIf}
|
|
|
-
|
|
|
- Result := TRUE;
|
|
|
- if not appInitialized Then
|
|
|
- begin
|
|
|
- oglWidth := wndWidth;
|
|
|
- oglHeight := wndHeight;
|
|
|
- oglTargetW := wndWidth;
|
|
|
- oglTargetH := wndHeight;
|
|
|
- exit;
|
|
|
+ // Rus: указатель на три координаты точки - X, Y, Z.
|
|
|
+ // Eng: pointer to three point coordinates - X, Y, Z.
|
|
|
+ zglPPoint3D = ^zglTPoint3D;
|
|
|
+ // Rus: три координаты точки - X, Y, Z.
|
|
|
+ // Eng: three point coordinates - X, Y, Z.
|
|
|
+ zglTPoint3D = record
|
|
|
+ X, Y, Z: Single;
|
|
|
end;
|
|
|
- scr_VSync;
|
|
|
-
|
|
|
-{$IFDEF USE_X11}
|
|
|
- if wndFullScreen Then
|
|
|
- begin
|
|
|
- scrCurrent := -1;
|
|
|
- mode := scrModeList;
|
|
|
-
|
|
|
- for modeToSet := 0 to scrModeCount - 1 do
|
|
|
- if (mode.Width = wndWidth) and (mode.Height = wndHeight) Then
|
|
|
- begin
|
|
|
- scrCurrent := modeToSet;
|
|
|
- break;
|
|
|
- end else
|
|
|
- INC(mode);
|
|
|
-
|
|
|
- if (scrCurrent = -1) or (XRRSetScreenConfig(scrDisplay, scrSettings, wndRoot, scrCurrent, scrRotation, CurrentTime) <> 0) Then
|
|
|
- begin
|
|
|
- u_Warning('Cannot set fullscreen mode: ' + u_IntToStr(wndWidth) + 'x' + u_IntToStr(wndHeight));
|
|
|
- scrCurrent := scrDesktop;
|
|
|
- wndFullScreen := FALSE;
|
|
|
- Result := FALSE;
|
|
|
- exit;
|
|
|
- end;
|
|
|
- end else
|
|
|
- scr_SetWindowedMode();
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF WINDOWS}
|
|
|
- if wndFullScreen Then
|
|
|
- begin
|
|
|
- i := 0;
|
|
|
- r := 0;
|
|
|
- FillChar(scrSettings, SizeOf(DEVMODEW), 0);
|
|
|
- scrSettings.dmSize := SizeOf(DEVMODEW);
|
|
|
- while EnumDisplaySettingsW(scrMonInfo.szDevice, i, scrSettings) <> FALSE do
|
|
|
- with scrSettings do
|
|
|
- begin
|
|
|
- dmFields := DM_PELSWIDTH or DM_PELSHEIGHT or DM_BITSPERPEL or DM_DISPLAYFREQUENCY;
|
|
|
- if (dmPelsWidth = wndWidth) and (dmPelsHeight = wndHeight) and (dmBitsPerPel = 32) and (dmDisplayFrequency > r) and
|
|
|
- (dmDisplayFrequency <= scrDesktop.dmDisplayFrequency) Then
|
|
|
- begin
|
|
|
- if ChangeDisplaySettingsExW(scrMonInfo.szDevice, scrSettings, 0, CDS_TEST, nil) = DISP_CHANGE_SUCCESSFUL Then
|
|
|
- r := dmDisplayFrequency
|
|
|
- else
|
|
|
- break;
|
|
|
- end;
|
|
|
- INC(i);
|
|
|
- end;
|
|
|
|
|
|
- with scrSettings do
|
|
|
- begin
|
|
|
- if scrRefresh = REFRESH_MAXIMUM Then scrRefresh := r;
|
|
|
- if scrRefresh = REFRESH_DEFAULT Then scrRefresh := 0;
|
|
|
-
|
|
|
- dmPelsWidth := wndWidth;
|
|
|
- dmPelsHeight := wndHeight;
|
|
|
- dmBitsPerPel := 32;
|
|
|
- dmDisplayFrequency := scrRefresh;
|
|
|
- dmFields := DM_PELSWIDTH or DM_PELSHEIGHT or DM_BITSPERPEL or DM_DISPLAYFREQUENCY;
|
|
|
- end;
|
|
|
-
|
|
|
- if ChangeDisplaySettingsExW(scrMonInfo.szDevice, scrSettings, 0, CDS_TEST, nil) <> DISP_CHANGE_SUCCESSFUL Then
|
|
|
- begin
|
|
|
- u_Warning('Cannot set fullscreen mode: ' + u_IntToStr(wndWidth) + 'x' + u_IntToStr(wndHeight));
|
|
|
- wndFullScreen := FALSE;
|
|
|
- Result := FALSE;
|
|
|
- exit;
|
|
|
- end else
|
|
|
- ChangeDisplaySettingsExW(scrMonInfo.szDevice, scrSettings, 0, CDS_FULLSCREEN, nil);
|
|
|
-
|
|
|
- scrRefresh := scrDesktop.dmDisplayFrequency;
|
|
|
- end else
|
|
|
- scr_SetWindowedMode();
|
|
|
-{$ENDIF}
|
|
|
-{$IFDEF MACOSX}{$IfDef MAC_COCOA}
|
|
|
- if winOn then
|
|
|
- begin
|
|
|
- if wndFullScreen then
|
|
|
- begin
|
|
|
- viewNSRect.origin.x := 0;
|
|
|
- viewNSRect.origin.y := 0;
|
|
|
- viewNSRect.size.width := scrDesktopW;
|
|
|
- viewNSRect.size.height := scrDesktopH;
|
|
|
- wndHandle.setStyleMask(NSBorderlessWindowMask);
|
|
|
- wndHandle.setFrame_display(viewNSRect, True);
|
|
|
- end
|
|
|
- else begin
|
|
|
- viewNSRect.origin.x := wndX;
|
|
|
- viewNSRect.origin.y := wndY;
|
|
|
- viewNSRect.size.width := wndWidth;
|
|
|
- viewNSRect.size.height := wndHeight + 0;
|
|
|
- wndHandle.setStyleMask(NSTitledWindowMask or NSClosableWindowMask);
|
|
|
- wndHandle.setFrame_display(viewNSRect, True);
|
|
|
- end;
|
|
|
+ // Rus: указатель на две координаты точки - массив из одного элемента.
|
|
|
+ // Eng: a pointer to two point coordinates - an array of one element.
|
|
|
+ zglPPoints2D = ^zglTPoints2D;
|
|
|
+ // Rus: две координаты точки - массив из одного элемента.
|
|
|
+ // Eng: two coordinates of a point - an array of one element.
|
|
|
+ zglTPoints2D = array[0..0] of zglTPoint2D;
|
|
|
+
|
|
|
+ // Rus: Указатель на линию. Две координаты XY (то же самое что и вектор).
|
|
|
+ // Eng:
|
|
|
+ zglPLine2D = ^zglTLine2D;
|
|
|
+ // Rus: Координаты линии XY. То же самое что и вектор.
|
|
|
+ // Eng:
|
|
|
+ zglTLine2D = record
|
|
|
+ x1, y1: Single;
|
|
|
+ x2, y2: Single;
|
|
|
end;
|
|
|
-{$Else}
|
|
|
- if wndFullScreen Then
|
|
|
- begin
|
|
|
- if (scrRefresh <> 0) and (scrRefresh <> 1) Then
|
|
|
- begin
|
|
|
- scrSettings := CGDisplayBestModeForParametersAndRefreshRate(scrDisplay, 32, wndWidth, wndHeight, scrRefresh, b);
|
|
|
- scrRefresh := b;
|
|
|
- end;
|
|
|
- if (scrRefresh = 0) or (scrRefresh = 1) Then
|
|
|
- scrSettings := CGDisplayBestModeForParameters(scrDisplay, 32, wndWidth, wndHeight, b);
|
|
|
-
|
|
|
- if (b <> 1) or (CGDisplaySwitchToMode(scrDisplay, scrSettings) <> kCGErrorSuccess) Then
|
|
|
- begin
|
|
|
- u_Warning('Cannot set fullscreen mode: ' + u_IntToStr(wndWidth) + 'x' + u_IntToStr(wndHeight));
|
|
|
- wndFullScreen := FALSE;
|
|
|
- Result := FALSE;
|
|
|
- exit;
|
|
|
- end;
|
|
|
|
|
|
- HideMenuBar();
|
|
|
- end else
|
|
|
- scr_SetWindowedMode();
|
|
|
-{$ENDIF}{$EndIf}
|
|
|
- if wndFullScreen Then
|
|
|
- log_Add('Screen options changed to: ' + u_IntToStr(wndWidth) + ' x ' + u_IntToStr(wndHeight) + ' fullscreen')
|
|
|
- else
|
|
|
- log_Add('Screen options changed to: ' + u_IntToStr(wndWidth) + ' x ' + u_IntToStr(wndHeight) + ' windowed');
|
|
|
-
|
|
|
- {$IfDef USE_INIT_HANDLE}
|
|
|
- if (not wndFullScreen) and (appFlags and WND_USE_AUTOCENTER > 0) Then
|
|
|
- wnd_SetPos((zgl_Get(DESKTOP_WIDTH) - wndWidth) div 2, (zgl_Get(DESKTOP_HEIGHT) - wndHeight) div 2);
|
|
|
- wnd_SetSize(wndWidth, wndHeight);
|
|
|
- {$Else}
|
|
|
- {$IfNDef ANDROID}
|
|
|
- if winOn Then
|
|
|
- wnd_Update();
|
|
|
- {$Else}
|
|
|
- wnd_SetSize(wndWidth, wndHeight);
|
|
|
- {$EndIf}{$EndIf}
|
|
|
-end;
|
|
|
-
|
|
|
-procedure scr_CorrectResolution(Width, Height: Word);
|
|
|
-begin
|
|
|
- {$IfDef ANDROID}
|
|
|
- _wndWidth := Width;
|
|
|
- _wndHeight := Height;
|
|
|
- {$EndIf}
|
|
|
- {$IfDef MAC_COCOA}
|
|
|
- zgl_Disable(CORRECT_RESOLUTION);
|
|
|
- {$Else}
|
|
|
- scrResW := Width;
|
|
|
- scrResH := Height;
|
|
|
- scrResCX := wndWidth / Width;
|
|
|
- scrResCY := wndHeight / Height;
|
|
|
- render2dClipW := Width;
|
|
|
- render2dClipH := Height;
|
|
|
- render2dClipXW := render2dClipX + render2dClipW;
|
|
|
- render2dClipYH := render2dClipY + render2dClipH;
|
|
|
-
|
|
|
- if scrResCX < scrResCY Then
|
|
|
- begin
|
|
|
- scrAddCX := 0;
|
|
|
- scrAddCY := Round((wndHeight - Height * scrResCX) / 2);
|
|
|
- scrResCY := scrResCX;
|
|
|
- end else
|
|
|
- begin
|
|
|
- scrAddCX := Round((wndWidth - Width * scrResCY) / 2);
|
|
|
- scrAddCY := 0;
|
|
|
- scrResCX := scrResCY;
|
|
|
+ // Rus: Указатель на линию. две координаты XYZ (то же самое что и вектор).
|
|
|
+ // Eng: Line pointer. Two XY coordinates (same as a vector).
|
|
|
+ zglPLine3D = ^zglTLine3D;
|
|
|
+ // Rus: линия - две координаты XYZ. То же самое что и вектор.
|
|
|
+ // Eng: line - two XYZ coordinates. The same as a vector.
|
|
|
+ zglTLine3D = record
|
|
|
+ x1, y1, z1: Single;
|
|
|
+ x2, y2, z2: Single;
|
|
|
end;
|
|
|
|
|
|
- if appFlags and CORRECT_HEIGHT = 0 Then
|
|
|
- begin
|
|
|
- scrResCY := wndHeight / Height;
|
|
|
- scrAddCY := 0;
|
|
|
- end;
|
|
|
- if appFlags and CORRECT_WIDTH = 0 Then
|
|
|
- begin
|
|
|
- scrResCX := wndWidth / Width;
|
|
|
- scrAddCX := 0;
|
|
|
+ // Rus: указатель на вектор - 2 точки - X, Y.
|
|
|
+ // Eng: pointer to vector - 2 points - X, Y.
|
|
|
+ zglPVector2D = ^zglTVector2D;
|
|
|
+ // Rus: вектор - 2 точки - X, Y.
|
|
|
+ // Eng: vector - 2 points - X, Y.
|
|
|
+ zglTVector2D = record
|
|
|
+ x1, y1: Single;
|
|
|
+ x2, y2: Single;
|
|
|
end;
|
|
|
|
|
|
- oglWidth := Round(wndWidth / scrResCX);
|
|
|
- oglHeight := Round(wndHeight / scrResCY);
|
|
|
- scrSubCX := oglWidth - Width;
|
|
|
- scrSubCY := oglHeight - Height;
|
|
|
- SetCurrentMode(oglMode);
|
|
|
- {$EndIf}
|
|
|
-end;
|
|
|
-
|
|
|
-procedure scr_SetViewPort2D;
|
|
|
-begin
|
|
|
- if oglTarget = TARGET_SCREEN Then
|
|
|
- begin
|
|
|
- if (appFlags and CORRECT_RESOLUTION > 0) and (oglMode = 2) Then
|
|
|
- begin
|
|
|
- scrViewportX := scrAddCX;
|
|
|
- scrViewportY := scrAddCY;
|
|
|
- scrViewportW := wndWidth - scrAddCX * 2;
|
|
|
- scrViewportH := wndHeight - scrAddCY * 2;
|
|
|
- end else
|
|
|
- begin
|
|
|
- scrViewportX := 0;
|
|
|
- scrViewportY := 0;
|
|
|
- scrViewportW := wndWidth;
|
|
|
- scrViewportH := wndHeight;
|
|
|
- end;
|
|
|
- end else
|
|
|
- begin
|
|
|
- scrViewportX := 0;
|
|
|
- scrViewportY := 0;
|
|
|
- scrViewportW := oglTargetW;
|
|
|
- scrViewportH := oglTargetH;
|
|
|
+ // Rus: указатель на вектор - 2 точки - X, Y, Z.
|
|
|
+ // Eng: vector pointer - 2 points - X, Y, Z.
|
|
|
+ zglPVector3D = ^zglTVector3D;
|
|
|
+ // Rus: вектор - 2 точки - X, Y, Z.
|
|
|
+ // Eng: vector - 2 points - X, Y, Z.
|
|
|
+ zglTVector3D = record
|
|
|
+ x1, y1, z1: Single;
|
|
|
+ x2, y2, z2: Single;
|
|
|
end;
|
|
|
|
|
|
- if appFlags and CORRECT_RESOLUTION > 0 Then
|
|
|
- begin
|
|
|
- render2dClipW := scrResW;
|
|
|
- render2dClipH := scrResH;
|
|
|
- render2dClipXW := render2dClipX + render2dClipW;
|
|
|
- render2dClipYH := render2dClipY + render2dClipH;
|
|
|
- end else
|
|
|
- begin
|
|
|
- render2dClipW := scrViewportW;
|
|
|
- render2dClipH := scrViewportH;
|
|
|
- render2dClipXW := render2dClipX + render2dClipW;
|
|
|
- render2dClipYH := render2dClipY + render2dClipH;
|
|
|
+ // Rus: указатель на прямоугольник - координаты, ширина, высота - Single.
|
|
|
+ // Eng: pointer to rectangle - coordinates, width, height - Single.
|
|
|
+ zglPRect2D = ^zglTRect2D;
|
|
|
+ // Rus: прямоугольник - координаты, ширина, высота - Single.
|
|
|
+ // Eng: rectangle - coordinates, width, height - Single.
|
|
|
+ zglTRect2D = record
|
|
|
+ X, Y, W, H: Single;
|
|
|
end;
|
|
|
|
|
|
- glViewPort(scrViewportX, scrViewportY, scrViewportW, scrViewportH);
|
|
|
-end;
|
|
|
-
|
|
|
-procedure scr_SetVSync(WSync: Boolean);
|
|
|
-begin
|
|
|
- {$IfNDef USE_INIT_HANDLE}
|
|
|
- if (useFPS > 60) and WSync then
|
|
|
- scr_SetFPS(60);
|
|
|
- {$EndIf}
|
|
|
- scrVSync := WSync;
|
|
|
-end;
|
|
|
-
|
|
|
-procedure scr_SetClearColor(flag: Boolean = true; Color: Cardinal = 0);
|
|
|
-begin
|
|
|
- scrClearColor := flag;
|
|
|
- scr_UseClearColor.R := (Color shr 16) / 255;
|
|
|
- scr_UseClearColor.G := ((Color and $FF00) shr 8) / 255;
|
|
|
- scr_UseClearColor.B := (Color and $FF) / 255;
|
|
|
- scr_UseClearColor.A := 1;
|
|
|
-end;
|
|
|
-
|
|
|
-procedure scr_VSync;
|
|
|
-begin
|
|
|
-{$IFNDEF USE_GLES}
|
|
|
- {$IFDEF USE_X11}
|
|
|
- if oglCanVSync Then
|
|
|
- glXSwapIntervalSGI(Integer(scrVSync));
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF WINDOWS}
|
|
|
- if oglCanVSync Then
|
|
|
- wglSwapIntervalEXT(Integer(scrVSync));
|
|
|
- {$ENDIF}
|
|
|
- {$IFDEF MACOSX}{$IfDef MAC_COCOA}
|
|
|
-// oglContext.setValues_forParameter(30, NSOpenGLCPSwapInterval);
|
|
|
- {$Else}
|
|
|
- if Assigned(oglContext) Then
|
|
|
- aglSetInt(oglContext, AGL_SWAP_INTERVAL, Byte(scrVSync));
|
|
|
- {$ENDIF}{$EndIf}
|
|
|
-{$ELSE}
|
|
|
- {$IFNDEF NO_EGL}
|
|
|
- if oglCanVSync Then
|
|
|
- eglSwapInterval(oglDisplay, Integer(scrVSync));
|
|
|
- {$ENDIF}
|
|
|
-{$ENDIF}
|
|
|
-end;
|
|
|
-
|
|
|
-{$IfNDef USE_INIT_HANDLE}
|
|
|
-procedure scr_SetFPS(FPS: LongWord);
|
|
|
-begin
|
|
|
- if FPS < 30 then
|
|
|
- FPS := 30;
|
|
|
- if (FPS <> 60) and (FPS <> 75) and (FPS <> 85) and (FPS <> 90) and (FPS <> 100) and (FPS <> 120) and (FPS <> 144) then
|
|
|
- FPS := 60;
|
|
|
- useFPS := FPS;
|
|
|
- if useFPS > 60 then
|
|
|
- begin
|
|
|
- scrVSync := True;
|
|
|
- scr_VSync;
|
|
|
+ // Begin point - end point
|
|
|
+ // Rus: указатель на прямоугольник - начальная и конечная координаты - Single.
|
|
|
+ // Eng: pointer to rectangle - start and end coordinates - Single.
|
|
|
+ zglPRectBPEP2D = ^zglTRectBPEP2D;
|
|
|
+ // Begin point - end point
|
|
|
+ // Rus: прямоугольник - начальная и конечная координаты - Single.
|
|
|
+ // Eng: rectangle - start and end coordinates - Single.
|
|
|
+ zglTRectBPEP2D = record
|
|
|
+ X1, Y1, X2, Y2: Single;
|
|
|
end;
|
|
|
- maxFPS := 1000 / FPS;
|
|
|
-end;
|
|
|
-{$EndIf}
|
|
|
-
|
|
|
-{procedure scr_SetFSAA(FSAA: Byte);
|
|
|
-begin
|
|
|
- if oglFSAA = FSAA Then exit;
|
|
|
- oglFSAA := FSAA;
|
|
|
|
|
|
- gl_Destroy();
|
|
|
- log_Add('Start reinitialization of OpenGL');
|
|
|
+ // Rus: указатель на произвольный четырёхугольник - четыре координаты - Single.
|
|
|
+ // Eng: pointer to arbitrary quadrilateral - four coordinates - Single.
|
|
|
+ zglPRectPoints2D = ^zglTRectPoints2D;
|
|
|
+ // Rus: произвольный четырёхугольник - четыре координаты - Single.
|
|
|
+ // Eng: arbitrary quadrilateral - four coordinates - Single.
|
|
|
+ zglTRectPoints2D = record
|
|
|
+ x1, y1: Single;
|
|
|
+ x2, y2: Single;
|
|
|
+ x3, y3: Single;
|
|
|
+ x4, y4: Single;
|
|
|
+ end;
|
|
|
|
|
|
- gl_Create();
|
|
|
- wnd_Destroy();
|
|
|
- wnd_Create();
|
|
|
-// wnd_SetCaption();
|
|
|
- gl_Initialize();
|
|
|
- if oglFSAA <> 0 Then
|
|
|
- log_Add('FSAA changed to: ' + u_IntToStr(oglFSAA) + 'x')
|
|
|
- else
|
|
|
- log_Add('FSAA changed to: off');
|
|
|
-end;}
|
|
|
+ // Rus: указатель на прямоугольник - координаты, ширина, высота - Word.
|
|
|
+ // Eng: pointer to rectangle - coordinates, width, height - Word.
|
|
|
+ zglPWordRect2D = ^zglTWordRect2D;
|
|
|
+ // Rus: прямоугольник - координаты, ширина, высота - Word.
|
|
|
+ // Eng: rectangle - coordinates, width, height - Word.
|
|
|
+ zglTWordRect2D = record
|
|
|
+ X, Y, W, H: Word;
|
|
|
+ end;
|
|
|
|
|
|
-procedure scr_ReadPixels(var pData: Pointer; X, Y, Width, Height: Word);
|
|
|
-begin
|
|
|
- batch2d_Flush();
|
|
|
- GetMem(pData, Width * Height * 4);
|
|
|
- glReadPixels(X, oglHeight - Height - Y, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, pData);
|
|
|
-end;
|
|
|
+ // Rus: указатель на окружность - координата цетра и радиус.
|
|
|
+ // Eng: circle pointer - center coordinate and radius.
|
|
|
+ zglPCircle2D = ^zglTCircle2D;
|
|
|
+ // Rus: окружность - координата цетра и радиус.
|
|
|
+ // Eng: circle - center coordinate and radius.
|
|
|
+ zglTCircle2D = record
|
|
|
+ cX, cY: Single;
|
|
|
+ Radius: Single;
|
|
|
+ end;
|
|
|
|
|
|
-procedure Set2DNearFar(newNear, newFar: {$IfNDef USE_GLES}Double{$Else}{$IF DEFINED(USE_GLES_ON_DESKTOP) and DEFINED(USE_AMD_DRIVERS)}Double{$Else}Single{$IfEnd}{$EndIf});
|
|
|
-begin
|
|
|
- scrFar := newFar;
|
|
|
- scrNear := newNear;
|
|
|
-end;
|
|
|
+ // Rus: Для 3D ни чего не решено, потому большинство структур - предварительны.
|
|
|
+ // Eng: For 3D, nothing has been decided, because most of the structures are preliminary.
|
|
|
+
|
|
|
+ // параллелограм должен находиться по координатам, высоте, ширине, глубине и
|
|
|
+ // минимум углу поворота в пространстве от нуля.
|
|
|
+ // Rus: указатель на параллелограм - координаты, ширина, высота, глубина - Single.
|
|
|
+ // Eng: pointer to parallelogram - coordinates, width, height, depth - Single.
|
|
|
+ zglPRect3D = ^zglTRect3D;
|
|
|
+ // Rus: параллелограм - координаты, ширина, высота, глубина - Single.
|
|
|
+ // Eng: parallelogram - coordinates, width, height, depth - Single.
|
|
|
+ zglTRect3D = record
|
|
|
+ X, Y, Z, W, H, Gl: Single;
|
|
|
+ end;
|
|
|
|
|
|
-{$IfDef GL_VERSION_3_0}
|
|
|
-procedure SetGLVersionAndFlags({$IfNDef MAC_COCOA}major, minor: Integer; flag: LongWord = COMPATIBILITY_VERSION{$Else}mode: LongWord{$EndIf});
|
|
|
- {$IfNDef MAC_COCOA}
|
|
|
- procedure MajorMinor;
|
|
|
- begin
|
|
|
- if major > 4 then
|
|
|
- major := 4;
|
|
|
- maxGLVerMajor := major;
|
|
|
- if major = 4 then
|
|
|
- begin
|
|
|
- if minor > 6 then
|
|
|
- minor := 6;
|
|
|
- maxGLVerMinor := minor;
|
|
|
- exit;
|
|
|
- end;
|
|
|
- if major = 3 then
|
|
|
- begin
|
|
|
- if minor > 3 then
|
|
|
- minor := 3;
|
|
|
- maxGLVerMinor := minor;
|
|
|
- exit;
|
|
|
- end;
|
|
|
- if major = 2 then
|
|
|
- begin
|
|
|
- if minor > 1 then
|
|
|
- minor := 1;
|
|
|
- maxGLVerMinor := minor;
|
|
|
- exit;
|
|
|
- end;
|
|
|
- if major = 1 then
|
|
|
- begin
|
|
|
- if minor > 5 then
|
|
|
- minor := 5;
|
|
|
- maxGLVerMinor := minor;
|
|
|
- end;
|
|
|
+ // Begin point - end point
|
|
|
+ // так же нужен угол поворота в пространстве. Либо описанная плоскость.
|
|
|
+ // Rus: указатель на параллелограм - начальная и конечная координаты - Single.
|
|
|
+ // Параллелограм описываемый двумя трёхмерными точками.
|
|
|
+ // Eng: pointer to parallelogram - start and end coordinates - Single.
|
|
|
+ // Parallelogram described by two 3D points.
|
|
|
+ zglPRectBPEP3D = ^zglTRectBPEP3D;
|
|
|
+ // Begin point - end point
|
|
|
+ // Rus: параллелограм - начальная и конечная координаты - Single.
|
|
|
+ // Параллелограм описываемый двумя трёхмерными точками.
|
|
|
+ // Eng: parallelogram - start and end coordinates - Single.
|
|
|
+ // Parallelogram described by two 3D points.
|
|
|
+ zglTRectBPEP3D = record
|
|
|
+ X1, Y1, Z1, X2, Y2, Z2: Single;
|
|
|
end;
|
|
|
- {$EndIf}
|
|
|
|
|
|
-begin
|
|
|
- {$IfDef MACOSX}
|
|
|
- if (mode > CORE_4_1) or (mode = 0) then
|
|
|
- mode := CORE_2_1;
|
|
|
- if mode = CORE_3_2 then
|
|
|
- begin
|
|
|
- oglAttr[8] := $3200;
|
|
|
- exit;
|
|
|
+ // Rus: указатель на произвольный восьмиугольник - восемь координат - Single.
|
|
|
+ // Eng: pointer to an arbitrary octagon - eight coordinates - Single.
|
|
|
+ zglPRectPoints3D = ^zglTRectPoints3D;
|
|
|
+ // Rus: произвольный восьмиугольник - восемь координат - Single.
|
|
|
+ // Eng: arbitrary octagon - eight coordinates - Single.
|
|
|
+ zglTRectPoints3D = record
|
|
|
+ x1, y1, z1, x2, y2, z2: Single;
|
|
|
+ x3, y3, z3, x4, y4, z4: Single;
|
|
|
+ x5, y5, z5, x6, y6, z6: Single;
|
|
|
+ x7, y7, z7, x8, y8, z8: Single;
|
|
|
end;
|
|
|
- if mode = CORE_4_1 then
|
|
|
- begin
|
|
|
- oglAttr[8] := $4100;
|
|
|
- exit;
|
|
|
+
|
|
|
+ // Rus: указатель на сферу - координата цетра и радиус.
|
|
|
+ // Eng: sphere pointer - center coordinate and radius.
|
|
|
+ zglPCircle3D = ^zglTCircle3D;
|
|
|
+ // Rus: сфера - координата цетра и радиус.
|
|
|
+ // Eng: sphere - center coordinate and radius.
|
|
|
+ zglTCircle3D = record
|
|
|
+ cX, cY, cZ: Single;
|
|
|
+ Radius: Single;
|
|
|
end;
|
|
|
- oglAttr[8] := $1000;
|
|
|
- {$Else}
|
|
|
+(*******************************************************************************
|
|
|
+* end primitives *
|
|
|
+*******************************************************************************)
|
|
|
|
|
|
- if (flag and 3) = 3 then
|
|
|
- flag := flag and 13;
|
|
|
- contextMask := flag and 3;
|
|
|
- contextFlags := (flag and 12) shr 2;
|
|
|
+(*******************************************************************************
|
|
|
+* POSIX TYPE DEFINITIONS *
|
|
|
+*******************************************************************************)
|
|
|
+type
|
|
|
+ cint8 = shortint; pcint8 = ^cint8;
|
|
|
+ cuint8 = byte; pcuint8 = ^cuint8;
|
|
|
+ cchar = cint8; pcchar = ^cchar;
|
|
|
+ cschar = cint8; pcschar = ^cschar;
|
|
|
+ cuchar = cuint8; pcuchar = ^cuchar;
|
|
|
+ cint16 = smallint; pcint16 = ^cint16;
|
|
|
+ cuint16 = word; pcuint16 = ^cuint16;
|
|
|
+ cint32 = longint; pcint32 = ^cint32;
|
|
|
+ cuint32 = longword; pcuint32 = ^cuint32;
|
|
|
+ cint = cint32; pcint = ^cint;
|
|
|
+ csint = cint32; pcsint = ^csint;
|
|
|
+ cuint = cuint32; pcuint = ^cuint;
|
|
|
+ cuint64 = qword; pcuint64 = ^cuint64;
|
|
|
+ cint64 = int64; pcint64 = ^cint64;
|
|
|
+ cbool = longbool; pcbool = ^cbool;
|
|
|
+{$If defined(CPUx86_64) and not defined(WINDOWS)}
|
|
|
+ clong = int64; pclong = ^clong;
|
|
|
+ cslong = int64; pcslong = ^cslong;
|
|
|
+ culong = qword; pculong = ^culong;
|
|
|
+{$Else}
|
|
|
+ clong = longint; pclong = ^clong;
|
|
|
+ cslong = longint; pcslong = ^cslong;
|
|
|
+ culong = cardinal; pculong = ^culong;
|
|
|
+{$IfEnd}
|
|
|
+ cfloat = single; pcfloat = ^cfloat;
|
|
|
+ cdouble = double; pcdouble = ^cdouble;
|
|
|
|
|
|
- MajorMinor;
|
|
|
- {$IfDef LINUX}
|
|
|
- if (major > 3) or ((major = 3) and (minor >= 2)) then
|
|
|
- begin
|
|
|
- if contextMask = 2 then
|
|
|
- contextMask := 1;
|
|
|
- end;
|
|
|
- {$EndIf}
|
|
|
- {$EndIf}
|
|
|
-end;
|
|
|
-{$EndIf}
|
|
|
+ csize_t = culong;
|
|
|
+
|
|
|
+implementation
|
|
|
|
|
|
end.
|