-
Notifications
You must be signed in to change notification settings - Fork 7
Translate pixel format and colorspace macros #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -360,5 +360,16 @@ function SDL_CreateThreadWithProperties(props: TSDL_PropertiesID): PSDL_Thread; | |
| SDL_CreateThreadWithProperties:=SDL_CreateThreadWithPropertiesRuntime(props,TSDL_FunctionPointer(SDL_BeginThreadFunction),TSDL_FunctionPointer(SDL_EndThreadFunction)); | ||
| end; | ||
|
|
||
| end. | ||
| { Macros from SDL_mouse.h } | ||
| function SDL_BUTTON_MASK(X: TSDL_MouseButtonFlags): TSDL_MouseButtonFlags; | ||
| begin | ||
| Result := TSDL_MouseButtonFlags(1) shl (X-1) | ||
| end; | ||
|
|
||
| { Macros from SDL_stdinc.h} | ||
| function SDL_FOURCC(A, B, C, D: AnsiChar): cuint32; | ||
| begin | ||
| Result := (cuint32(Ord(A)) shl 0) or (cuint32(Ord(B)) shl 8) or (cuint32(Ord(C)) shl 16) or (cuint32(Ord(D)) shl 24) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add semicolon please. |
||
| end; | ||
|
|
||
| end. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,16 +145,17 @@ type | |
| PSDL_MouseButtonFlags = ^TSDL_MouseButtonFlags; | ||
| TSDL_MouseButtonFlags = type cuint32; | ||
|
|
||
| function SDL_BUTTON_MASK(X: TSDL_MouseButtonFlags): TSDL_MouseButtonFlags; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be consistent with the original code, this function should be right above SDL_BUTTON_LMASK. I would suggest to move it down and have the following structure: |
||
|
|
||
| const | ||
| SDL_BUTTON_LEFT = TSDL_MouseButtonFlags(1); | ||
| SDL_BUTTON_MIDDLE = TSDL_MouseButtonFlags(2); | ||
| SDL_BUTTON_RIGHT = TSDL_MouseButtonFlags(3); | ||
| SDL_BUTTON_X1 = TSDL_MouseButtonFlags(4); | ||
| SDL_BUTTON_X2 = TSDL_MouseButtonFlags(5); | ||
|
|
||
| {SDL3-for-Pascal: The C macro SDL_BUTTON_MASK is not implemented but the mask | ||
| defines are directly translated. } | ||
| {#define SDL_BUTTON_MASK(X) (1u << ((X)-1)) } | ||
| {SDL3-for-Pascal: FPC does not allow assigning function results to consts, | ||
| so these values are calculated manually. } | ||
| SDL_BUTTON_LMASK = TSDL_MouseButtonFlags(1 shl SDL_BUTTON_LEFT-1); { SDL_BUTTON_MASK(SDL_BUTTON_LEFT) } | ||
| SDL_BUTTON_MMASK = TSDL_MouseButtonFlags(1 shl SDL_BUTTON_MIDDLE-1); { SDL_BUTTON_MASK(SDL_BUTTON_MIDDLE) } | ||
| SDL_BUTTON_RMASK = TSDL_MouseButtonFlags(1 shl SDL_BUTTON_RIGHT-1); { SDL_BUTTON_MASK(SDL_BUTTON_RIGHT) } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add semicolon please.