Skip to content

Commit d5150cd

Browse files
Event type: Follow codestyle guidelines + clearify guidelines
1 parent 486ed38 commit d5150cd

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ These guidelines aim to have better consistency in this community project and ma
4040
it easier to find certain code parts in the C headers/Pascal includes. Feel free
4141
to discuss or extend these guidelines, use the issue tracker.
4242

43-
1. Names of C defines (constants) shall not be modified or "pascalified"
43+
1. Names of C defines (constants) and function parameters shall not be modified or "pascalified"
4444
Ex: `SDL_INIT_VIDEO` does not change into `SDLInitVideo`.
4545

46-
2. Names of function parameters shall not be modified or "pascalified"
47-
Ex.: `type_` in `function SDL_GetEventState(type_: TSDL_EventType): UInt8` does not change into `evType`.
46+
2. Names corresponding to reserved key words are kept and an underscore is added.
47+
Ex.: `type` in C function `SDL_HasEvent(Uint32 type)` changes into `type_`
48+
in Pascal function `SDL_HasEvent(type_: TSDL_EventType)`.
4849

4950
3. Use C data types like `UInt8`, `UInt16`, `UInt32`, `SInt8`, `SInt16`,
5051
`SInt32`, `Float` and so on as often as possible if it is used in the

sdl2.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,9 @@ function SDL_WINDOWPOS_ISCENTERED(X: Variant): Variant;
393393

394394
//from "sdl_events.h"
395395

396-
function SDL_GetEventState(evType: TSDL_EventType): UInt8;
396+
function SDL_GetEventState(type_: TSDL_EventType): UInt8;
397397
begin
398-
Result := SDL_EventState(evType, SDL_QUERY);
398+
Result := SDL_EventState(type_, SDL_QUERY);
399399
end;
400400

401401
// from "sdl_timer.h"

sdlevents.inc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -573,14 +573,14 @@ type
573573
* Checks to see if certain event types are in the event queue.
574574
*}
575575

576-
function SDL_HasEvent(evType: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvent' {$ENDIF} {$ENDIF};
576+
function SDL_HasEvent(type_: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvent' {$ENDIF} {$ENDIF};
577577
function SDL_HasEvents(minType, maxType: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvents' {$ENDIF} {$ENDIF};
578578

579579
{**
580580
* This function clears events from the event queue
581581
*}
582582

583-
procedure SDL_FlushEvent(evType: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvent' {$ENDIF} {$ENDIF};
583+
procedure SDL_FlushEvent(type_: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvent' {$ENDIF} {$ENDIF};
584584
procedure SDL_FlushEvents(minType, maxType: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvents' {$ENDIF} {$ENDIF};
585585

586586
{**
@@ -629,7 +629,7 @@ type
629629
type
630630
PSDL_EventFilter = ^TSDL_EventFilter;
631631
{$IFNDEF GPC}
632-
TSDL_EventFilter = function( userdata: Pointer; event: PSDL_Event ): Integer; cdecl;
632+
TSDL_EventFilter = function(userdata: Pointer; event: PSDL_Event): Integer; cdecl;
633633
{$ELSE}
634634
TSDL_EventFilter = function( userdata: Pointer; event: PSDL_Event ): Integer;
635635
{$ENDIF}
@@ -700,9 +700,9 @@ const
700700
* current processing state of the specified event.
701701
*}
702702

703-
function SDL_EventState(evType: TSDL_EventType; state: SInt32): UInt8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EventState' {$ENDIF} {$ENDIF};
703+
function SDL_EventState(type_: TSDL_EventType; state: SInt32): UInt8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EventState' {$ENDIF} {$ENDIF};
704704

705-
function SDL_GetEventState(evType: TSDL_EventType): UInt8;
705+
function SDL_GetEventState(type_: TSDL_EventType): UInt8;
706706

707707
{**
708708
* This function allocates a set of user-defined events, and returns

0 commit comments

Comments
 (0)