[1]


It's not fully true, because my Input class is only simple extension on existinng SDLInput.

Code:
type TF3D_Input = class

     private
        delta   : TF3D_Vector2f;
        old_pos : TPoint;
        Manager : TSDLInputManager;
     public
     constructor create;
     destructor destroy;
     procedure Update();
     function IsKeyDown(key:integer):boolean;
     function IsButtonDown(btn:integer):boolean;
     function IsKeyUp(key:integer):boolean;
     procedure ShowInfo(sx: integer; sy: integer);
     function GetMouseDelta:TF3D_Vector2f;



end;

implementation

uses F3Dlib;

{******************************************************************************}
{ F3D INPUT CONTROL:
{******************************************************************************}
constructor TF3D_Input.create;
begin
  inherited create;
  Manager := TSDLInputManager.Create([itKeyBoard, itMouse, itJoystick]);
end;

{******************************************************************************}
{ F3D INPUT CONTROL:
{******************************************************************************}
destructor TF3D_Input.destroy;
begin
  inherited destroy;
end;

{******************************************************************************}
{ F3D INPUT CONTROL:
{******************************************************************************}
procedure TF3D_Input.Update();
var dx,dy:integer;
begin

   SDL_GetRelativeMouseState(dx,dy);
   delta.x := dx;
   delta.y := dy;

   self.Manager.UpdateInputs(F3D.SDL.event);

end;

{******************************************************************************}
{ F3D INPUT CONTROL: KEY DOWN
{******************************************************************************}
function TF3D_Input.IsKeyDown(key:integer):boolean;
begin

      if self.Manager.KeyBoard.IsKeyDown(key) then result:=true
                                             else result:=false;

end;


{******************************************************************************}
{ F3D INPUT CONTROL: MOUSE BUTTON DOWN
{******************************************************************************}
function TF3D_Input.IsButtonDown(btn:integer):boolean;
begin

      if self.Manager.Mouse.MouseIsDown(btn) then result:=false
                                             else result:=true;

end;

{******************************************************************************}
{ F3D INPUT CONTROL:  KEY UP
{******************************************************************************}
function TF3D_Input.IsKeyUp(key:integer):boolean;
begin

      if self.Manager.KeyBoard.IsKeyDown(key) then result:=true
                                             else result:=false;



end;

{******************************************************************************}
{ F3D INPUT CONTROL: Get Delta mouse move
{******************************************************************************}
function TF3D_Input.GetMouseDelta:TF3D_Vector2f;
begin
     result:=self.delta;
end;


{******************************************************************************}
{ F3D INPUT CONTROL: DrawINFO
{******************************************************************************}
procedure TF3D_Input.ShowInfo(sx: integer; sy: integer);
var BTN_0, BTN_1, BTN_2: integer;
    WHEEL_UP,WHEEL_DOWN:integer;
begin
     if (not F3D.Config.use_infoscreen) then exit;

    glDisable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
    glColor4f(0, 0, 0, 0.5);
    F3D.Draw.Rectangle(sx - 8, sy - 4, sx + 256 + 16, sy + 84);

    glDisable(GL_BLEND);

    BTN_0 := 0;
    if self.Manager.Mouse.MouseIsUp(SDL_BUTTON_LEFT) then BTN_0 := 1;
    BTN_1 := 0;
    if self.Manager.Mouse.MouseIsUp(SDL_BUTTON_MIDDLE) then BTN_1 := 1;
    BTN_2 := 0;
    if self.Manager.Mouse.MouseIsUp(SDL_BUTTON_RIGHT) then BTN_2 := 1;
    WHEEL_UP:=0;
    WHEEL_DOWN:=0;
    if self.Manager.Mouse.MouseIsDown(SDL_BUTTON_WHEELUP) then WHEEL_UP := 1;        // ??????????
    if self.Manager.Mouse.MouseIsDown(SDL_BUTTON_WHEELDOWN) then WHEEL_DOWN := 1;    // ??????????

    glDisable(GL_BLEND);
    F3D.Hud.SetFontColor('CourierNew', SetColor4f(1, 0.5, 0, 1));
    F3D.Hud.Print('CourierNew', sx, sy + 13 * 0, 'MOUSE CONTROL:');
    F3D.Hud.SetFontColor('CourierNew', SetColor4f(1, 1, 1, 1));
    F3D.Hud.Print('CourierNew', sx, sy + 13 * 1, format('MOUSE DELTA    : %8.4f %8.4f ', [self.delta.x,self.delta.y]));
    F3D.Hud.Print('CourierNew', sx, sy + 13 * 2, format('MOUSE POS      : %4d %4d ', [self.Manager.Mouse.MousePosition.X, self.Manager.Mouse.MousePosition.Y]));
    F3D.Hud.Print('CourierNew', sx, sy + 13 * 3, format('MOUSE BTN      : [%1d][%1d][%1d] ', [BTN_0, BTN_1, BTN_2]));
    F3D.Hud.Print('CourierNew', sx, sy + 13 * 4, format('MOUSE WHEEL UP : [%1d]  ', [WHEEL_UP]));
    F3D.Hud.Print('CourierNew', sx, sy + 13 * 5, format('MOUSE WHEEL DW : [%1d]  ', [WHEEL_DOWN]));
end;
end.

[2]

I found problem with mouse delta and LAG values answer i found in vry good document which help me. Here is part:

Timers
Timers are not something every game uses so you might be wondering why I’m covering them in this article. Trying to get SDL timers to work caused me a lot of aggravation and I spent hours trying to figure out what the problem was. I’m writing about SDL timers to save you the aggravation I went through.
A timer is a function the operating system calls periodically. You get to specify how often the timer fires, which is how often the operating system calls the timer. Use a timer when you want to do something repeatedly in your program at regular time intervals.



... now i have implemented USER TIMER and all is OK. Tonight will be released as ver 0.10

part of code:

Code:
function SDLLoop(interval: Uint32; param: Pointer ): Integer;
var event:TSDL_Event;
begin
     event.type_ := SDL_USEREVENT;
     event.user.code := RUN_FINAL3D_LOOP;
     event.user.data1 :=0;
     event.user.data2 :=0;

     SDL_PushEvent(@event);
     
     result := interval;
end;

....


  // initialize timer
   SDL_Init(SDL_INIT_TIMER);
   self.Timer :=  SDL_AddTimer(20,@SDLLoop,nil);


....

begin

    F3D := TF3D.Create();
    F3D.Initialize();

    APP_DO_INIT();

    Done := False;

    while ( not Done ) do
    begin
         while ( SDL_PollEvent( @F3D.SDL.event ) = 1 ) do
         begin
              case F3D.SDL.event.type_ of
                   SDL_QUITEV : Done := true;
                   SDL_USEREVENT :
                   begin
                        APP_DO_LOOP( F3D.SDL.event.user.code);
                   end;

              end;

         end;
    end;
    SDL_QUIT;
    Halt(0);
end.


....



procedure APP_DO_LOOP( code : integer );
begin
  case code of
    RUN_FINAL3D_LOOP : APP_DO_RENDER();
    end;
end;
[3]

WHEEL_UP and WHEEL_DOWN return always 1 ((