307 SDLK_HOME = 278; |
274 SDLK_HOME = 278; |
308 SDLK_END = 279; |
275 SDLK_END = 279; |
309 SDLK_PAGEUP = 280; |
276 SDLK_PAGEUP = 280; |
310 SDLK_PAGEDOWN = 281; |
277 SDLK_PAGEDOWN = 281; |
311 |
278 |
|
279 // special keycodes (for modifier keys etc. will have this bit set) |
|
280 SDLK_SCANCODE_MASK = (1 shl 30); |
|
281 |
|
282 SDL_SCANCODE_UNKNOWN = 0; |
|
283 SDL_SCANCODE_A = 4; |
|
284 SDL_SCANCODE_B = 5; |
|
285 SDL_SCANCODE_C = 6; |
|
286 SDL_SCANCODE_D = 7; |
|
287 SDL_SCANCODE_E = 8; |
|
288 SDL_SCANCODE_F = 9; |
|
289 SDL_SCANCODE_G = 10; |
|
290 SDL_SCANCODE_H = 11; |
|
291 SDL_SCANCODE_I = 12; |
|
292 SDL_SCANCODE_J = 13; |
|
293 SDL_SCANCODE_K = 14; |
|
294 SDL_SCANCODE_L = 15; |
|
295 SDL_SCANCODE_M = 16; |
|
296 SDL_SCANCODE_N = 17; |
|
297 SDL_SCANCODE_O = 18; |
|
298 SDL_SCANCODE_P = 19; |
|
299 SDL_SCANCODE_Q = 20; |
|
300 SDL_SCANCODE_R = 21; |
|
301 SDL_SCANCODE_S = 22; |
|
302 SDL_SCANCODE_T = 23; |
|
303 SDL_SCANCODE_U = 24; |
|
304 SDL_SCANCODE_V = 25; |
|
305 SDL_SCANCODE_W = 26; |
|
306 SDL_SCANCODE_X = 27; |
|
307 SDL_SCANCODE_Y = 28; |
|
308 SDL_SCANCODE_Z = 29; |
|
309 SDL_SCANCODE_1 = 30; |
|
310 SDL_SCANCODE_2 = 31; |
|
311 SDL_SCANCODE_3 = 32; |
|
312 SDL_SCANCODE_4 = 33; |
|
313 SDL_SCANCODE_5 = 34; |
|
314 SDL_SCANCODE_6 = 35; |
|
315 SDL_SCANCODE_7 = 36; |
|
316 SDL_SCANCODE_8 = 37; |
|
317 SDL_SCANCODE_9 = 38; |
|
318 SDL_SCANCODE_0 = 39; |
|
319 SDL_SCANCODE_RETURN = 40; |
|
320 SDL_SCANCODE_ESCAPE = 41; |
|
321 SDL_SCANCODE_BACKSPACE = 42; |
|
322 SDL_SCANCODE_TAB = 43; |
|
323 SDL_SCANCODE_SPACE = 44; |
|
324 SDL_SCANCODE_MINUS = 45; |
|
325 SDL_SCANCODE_EQUALS = 46; |
|
326 SDL_SCANCODE_LEFTBRACKET = 47; |
|
327 SDL_SCANCODE_RIGHTBRACKET = 48; |
|
328 SDL_SCANCODE_BACKSLASH = 49; |
|
329 SDL_SCANCODE_NONUSHASH = 50; |
|
330 SDL_SCANCODE_SEMICOLON = 51; |
|
331 SDL_SCANCODE_APOSTROPHE = 52; |
|
332 SDL_SCANCODE_GRAVE = 53; |
|
333 SDL_SCANCODE_COMMA = 54; |
|
334 SDL_SCANCODE_PERIOD = 55; |
|
335 SDL_SCANCODE_SLASH = 56; |
|
336 SDL_SCANCODE_CAPSLOCK = 57; |
|
337 SDL_SCANCODE_F1 = 58; |
|
338 SDL_SCANCODE_F2 = 59; |
|
339 SDL_SCANCODE_F3 = 60; |
|
340 SDL_SCANCODE_F4 = 61; |
|
341 SDL_SCANCODE_F5 = 62; |
|
342 SDL_SCANCODE_F6 = 63; |
|
343 SDL_SCANCODE_F7 = 64; |
|
344 SDL_SCANCODE_F8 = 65; |
|
345 SDL_SCANCODE_F9 = 66; |
|
346 SDL_SCANCODE_F10 = 67; |
|
347 SDL_SCANCODE_F11 = 68; |
|
348 SDL_SCANCODE_F12 = 69; |
|
349 SDL_SCANCODE_PRINTSCREEN = 70; |
|
350 SDL_SCANCODE_SCROLLLOCK = 71; |
|
351 SDL_SCANCODE_PAUSE = 72; |
|
352 SDL_SCANCODE_INSERT = 73; |
|
353 SDL_SCANCODE_HOME = 74; |
|
354 SDL_SCANCODE_PAGEUP = 75; |
|
355 SDL_SCANCODE_DELETE = 76; |
|
356 SDL_SCANCODE_END = 77; |
|
357 SDL_SCANCODE_PAGEDOWN = 78; |
|
358 SDL_SCANCODE_RIGHT = 79; |
|
359 SDL_SCANCODE_LEFT = 80; |
|
360 SDL_SCANCODE_DOWN = 81; |
|
361 SDL_SCANCODE_UP = 82; |
|
362 SDL_SCANCODE_NUMLOCKCLEAR = 83; |
|
363 SDL_SCANCODE_KP_DIVIDE = 84; |
|
364 SDL_SCANCODE_KP_MULTIPLY = 85; |
|
365 SDL_SCANCODE_KP_MINUS = 86; |
|
366 SDL_SCANCODE_KP_PLUS = 87; |
|
367 SDL_SCANCODE_KP_ENTER = 88; |
|
368 SDL_SCANCODE_KP_1 = 89; |
|
369 SDL_SCANCODE_KP_2 = 90; |
|
370 SDL_SCANCODE_KP_3 = 91; |
|
371 SDL_SCANCODE_KP_4 = 92; |
|
372 SDL_SCANCODE_KP_5 = 93; |
|
373 SDL_SCANCODE_KP_6 = 94; |
|
374 SDL_SCANCODE_KP_7 = 95; |
|
375 SDL_SCANCODE_KP_8 = 96; |
|
376 SDL_SCANCODE_KP_9 = 97; |
|
377 SDL_SCANCODE_KP_0 = 98; |
|
378 SDL_SCANCODE_KP_PERIOD = 99; |
|
379 SDL_SCANCODE_NONUSBACKSLASH = 100; |
|
380 SDL_SCANCODE_APPLICATION = 101; |
|
381 SDL_SCANCODE_POWER = 102; |
|
382 SDL_SCANCODE_KP_EQUALS = 103; |
|
383 SDL_SCANCODE_F13 = 104; |
|
384 SDL_SCANCODE_F14 = 105; |
|
385 SDL_SCANCODE_F15 = 106; |
|
386 SDL_SCANCODE_F16 = 107; |
|
387 SDL_SCANCODE_F17 = 108; |
|
388 SDL_SCANCODE_F18 = 109; |
|
389 SDL_SCANCODE_F19 = 110; |
|
390 SDL_SCANCODE_F20 = 111; |
|
391 SDL_SCANCODE_F21 = 112; |
|
392 SDL_SCANCODE_F22 = 113; |
|
393 SDL_SCANCODE_F23 = 114; |
|
394 SDL_SCANCODE_F24 = 115; |
|
395 SDL_SCANCODE_EXECUTE = 116; |
|
396 SDL_SCANCODE_HELP = 117; |
|
397 SDL_SCANCODE_MENU = 118; |
|
398 SDL_SCANCODE_SELECT = 119; |
|
399 SDL_SCANCODE_STOP = 120; |
|
400 SDL_SCANCODE_AGAIN = 121; |
|
401 SDL_SCANCODE_UNDO = 122; |
|
402 SDL_SCANCODE_CUT = 123; |
|
403 SDL_SCANCODE_COPY = 124; |
|
404 SDL_SCANCODE_PASTE = 125; |
|
405 SDL_SCANCODE_FIND = 126; |
|
406 SDL_SCANCODE_MUTE = 127; |
|
407 SDL_SCANCODE_VOLUMEUP = 128; |
|
408 SDL_SCANCODE_VOLUMEDOWN = 129; |
|
409 SDL_SCANCODE_KP_COMMA = 133; |
|
410 SDL_SCANCODE_KP_EQUALSAS400 = 134; |
|
411 SDL_SCANCODE_INTERNATIONAL1 = 135; |
|
412 SDL_SCANCODE_INTERNATIONAL2 = 136; |
|
413 SDL_SCANCODE_INTERNATIONAL3 = 137; |
|
414 SDL_SCANCODE_INTERNATIONAL4 = 138; |
|
415 SDL_SCANCODE_INTERNATIONAL5 = 139; |
|
416 SDL_SCANCODE_INTERNATIONAL6 = 140; |
|
417 SDL_SCANCODE_INTERNATIONAL7 = 141; |
|
418 SDL_SCANCODE_INTERNATIONAL8 = 142; |
|
419 SDL_SCANCODE_INTERNATIONAL9 = 143; |
|
420 SDL_SCANCODE_LANG1 = 144; (*< Hangul/English toggle *) |
|
421 SDL_SCANCODE_LANG2 = 145; (*< Hanja conversion *) |
|
422 SDL_SCANCODE_LANG3 = 146; (*< Katakana *) |
|
423 SDL_SCANCODE_LANG4 = 147; (*< Hiragana *) |
|
424 SDL_SCANCODE_LANG5 = 148; (*< Zenkaku/Hankaku *) |
|
425 SDL_SCANCODE_LANG6 = 149; (*< reserved *) |
|
426 SDL_SCANCODE_LANG7 = 150; (*< reserved *) |
|
427 SDL_SCANCODE_LANG8 = 151; (*< reserved *) |
|
428 SDL_SCANCODE_LANG9 = 152; (*< reserved *) |
|
429 SDL_SCANCODE_ALTERASE = 153; |
|
430 SDL_SCANCODE_SYSREQ = 154; |
|
431 SDL_SCANCODE_CANCEL = 155; |
|
432 SDL_SCANCODE_CLEAR = 156; |
|
433 SDL_SCANCODE_PRIOR = 157; |
|
434 SDL_SCANCODE_RETURN2 = 158; |
|
435 SDL_SCANCODE_SEPARATOR = 159; |
|
436 SDL_SCANCODE_OUT = 160; |
|
437 SDL_SCANCODE_OPER = 161; |
|
438 SDL_SCANCODE_CLEARAGAIN = 162; |
|
439 SDL_SCANCODE_CRSEL = 163; |
|
440 SDL_SCANCODE_EXSEL = 164; |
|
441 SDL_SCANCODE_KP_00 = 176; |
|
442 SDL_SCANCODE_KP_000 = 177; |
|
443 SDL_SCANCODE_THOUSANDSSEPARATOR = 178; |
|
444 SDL_SCANCODE_DECIMALSEPARATOR = 179; |
|
445 SDL_SCANCODE_CURRENCYUNIT = 180; |
|
446 SDL_SCANCODE_CURRENCYSUBUNIT = 181; |
|
447 SDL_SCANCODE_KP_LEFTPAREN = 182; |
|
448 SDL_SCANCODE_KP_RIGHTPAREN = 183; |
|
449 SDL_SCANCODE_KP_LEFTBRACE = 184; |
|
450 SDL_SCANCODE_KP_RIGHTBRACE = 185; |
|
451 SDL_SCANCODE_KP_TAB = 186; |
|
452 SDL_SCANCODE_KP_BACKSPACE = 187; |
|
453 SDL_SCANCODE_KP_A = 188; |
|
454 SDL_SCANCODE_KP_B = 189; |
|
455 SDL_SCANCODE_KP_C = 190; |
|
456 SDL_SCANCODE_KP_D = 191; |
|
457 SDL_SCANCODE_KP_E = 192; |
|
458 SDL_SCANCODE_KP_F = 193; |
|
459 SDL_SCANCODE_KP_XOR = 194; |
|
460 SDL_SCANCODE_KP_POWER = 195; |
|
461 SDL_SCANCODE_KP_PERCENT = 196; |
|
462 SDL_SCANCODE_KP_LESS = 197; |
|
463 SDL_SCANCODE_KP_GREATER = 198; |
|
464 SDL_SCANCODE_KP_AMPERSAND = 199; |
|
465 SDL_SCANCODE_KP_DBLAMPERSAND = 200; |
|
466 SDL_SCANCODE_KP_VERTICALBAR = 201; |
|
467 SDL_SCANCODE_KP_DBLVERTICALBAR = 202; |
|
468 SDL_SCANCODE_KP_COLON = 203; |
|
469 SDL_SCANCODE_KP_HASH = 204; |
|
470 SDL_SCANCODE_KP_SPACE = 205; |
|
471 SDL_SCANCODE_KP_AT = 206; |
|
472 SDL_SCANCODE_KP_EXCLAM = 207; |
|
473 SDL_SCANCODE_KP_MEMSTORE = 208; |
|
474 SDL_SCANCODE_KP_MEMRECALL = 209; |
|
475 SDL_SCANCODE_KP_MEMCLEAR = 210; |
|
476 SDL_SCANCODE_KP_MEMADD = 211; |
|
477 SDL_SCANCODE_KP_MEMSUBTRACT = 212; |
|
478 SDL_SCANCODE_KP_MEMMULTIPLY = 213; |
|
479 SDL_SCANCODE_KP_MEMDIVIDE = 214; |
|
480 SDL_SCANCODE_KP_PLUSMINUS = 215; |
|
481 SDL_SCANCODE_KP_CLEAR = 216; |
|
482 SDL_SCANCODE_KP_CLEARENTRY = 217; |
|
483 SDL_SCANCODE_KP_BINARY = 218; |
|
484 SDL_SCANCODE_KP_OCTAL = 219; |
|
485 SDL_SCANCODE_KP_DECIMAL = 220; |
|
486 SDL_SCANCODE_KP_HEXADECIMAL = 221; |
|
487 SDL_SCANCODE_LCTRL = 224; |
|
488 SDL_SCANCODE_LSHIFT = 225; |
|
489 SDL_SCANCODE_LALT = 226; |
|
490 SDL_SCANCODE_LGUI = 227; |
|
491 SDL_SCANCODE_RCTRL = 228; |
|
492 SDL_SCANCODE_RSHIFT = 229; |
|
493 SDL_SCANCODE_RALT = 230; |
|
494 SDL_SCANCODE_RGUI = 231; |
|
495 SDL_SCANCODE_MODE = 257; |
|
496 SDL_SCANCODE_AUDIONEXT = 258; |
|
497 SDL_SCANCODE_AUDIOPREV = 259; |
|
498 SDL_SCANCODE_AUDIOSTOP = 260; |
|
499 SDL_SCANCODE_AUDIOPLAY = 261; |
|
500 SDL_SCANCODE_AUDIOMUTE = 262; |
|
501 SDL_SCANCODE_MEDIASELECT = 263; |
|
502 SDL_SCANCODE_WWW = 264; |
|
503 SDL_SCANCODE_MAIL = 265; |
|
504 SDL_SCANCODE_CALCULATOR = 266; |
|
505 SDL_SCANCODE_COMPUTER = 267; |
|
506 SDL_SCANCODE_AC_SEARCH = 268; |
|
507 SDL_SCANCODE_AC_HOME = 269; |
|
508 SDL_SCANCODE_AC_BACK = 270; |
|
509 SDL_SCANCODE_AC_FORWARD = 271; |
|
510 SDL_SCANCODE_AC_STOP = 272; |
|
511 SDL_SCANCODE_AC_REFRESH = 273; |
|
512 SDL_SCANCODE_AC_BOOKMARKS = 274; |
|
513 SDL_SCANCODE_BRIGHTNESSDOWN = 275; |
|
514 SDL_SCANCODE_BRIGHTNESSUP = 276; |
|
515 SDL_SCANCODE_DISPLAYSWITCH = 277; |
|
516 SDL_SCANCODE_KBDILLUMTOGGLE = 278; |
|
517 SDL_SCANCODE_KBDILLUMDOWN = 279; |
|
518 SDL_SCANCODE_KBDILLUMUP = 280; |
|
519 SDL_SCANCODE_EJECT = 281; |
|
520 SDL_SCANCODE_SLEEP = 282; |
|
521 SDL_SCANCODE_APP1 = 283; |
|
522 SDL_SCANCODE_APP2 = 284; |
312 |
523 |
313 ///////////////////////////////////////////////////////////////// |
524 ///////////////////////////////////////////////////////////////// |
314 /////////////////////// TYPE DEFINITIONS /////////////////////// |
525 /////////////////////// TYPE DEFINITIONS /////////////////////// |
315 ///////////////////////////////////////////////////////////////// |
526 ///////////////////////////////////////////////////////////////// |
316 |
527 |
317 // two important reference points for the wanderers of this area |
528 // two important reference points for the wanderers of this area |
318 // http://www.freepascal.org/docs-html/ref/refsu5.html |
529 // http://www.freepascal.org/docs-html/ref/refsu5.html |
319 // http://www.freepascal.org/docs-html/prog/progsu144.html |
530 // http://www.freepascal.org/docs-html/prog/progsu144.html |
320 |
531 |
321 type |
532 type |
322 {$IFDEF SDL2} |
|
323 PSDL_Window = Pointer; |
533 PSDL_Window = Pointer; |
324 PSDL_Renderer = Pointer; |
534 PSDL_Renderer = Pointer; |
325 PSDL_Texture = Pointer; |
535 PSDL_Texture = Pointer; |
326 PSDL_GLContext= Pointer; |
536 PSDL_GLContext= Pointer; |
327 TSDL_TouchId = Int64; |
537 TSDL_TouchId = Int64; |
328 {$ENDIF} |
|
329 TSDL_FingerId = Int64; |
538 TSDL_FingerId = Int64; |
|
539 TSDL_Keycode = LongInt; |
|
540 TSDL_Scancode = LongInt; |
330 |
541 |
331 TSDL_eventaction = (SDL_ADDEVENT, SDL_PEEPEVENT, SDL_GETEVENT); |
542 TSDL_eventaction = (SDL_ADDEVENT, SDL_PEEPEVENT, SDL_GETEVENT); |
332 |
543 |
333 PSDL_Rect = ^TSDL_Rect; |
544 PSDL_Rect = ^TSDL_Rect; |
334 TSDL_Rect = record |
545 TSDL_Rect = record |
335 {$IFDEF SDL2} |
|
336 x, y, w, h: LongInt; |
546 x, y, w, h: LongInt; |
337 {$ELSE} |
|
338 x, y: SmallInt; |
|
339 w, h: Word; |
|
340 {$ENDIF} |
|
341 end; |
547 end; |
342 |
548 |
343 TPoint = record |
549 TPoint = record |
344 x, y: LongInt; |
550 x, y: LongInt; |
345 end; |
551 end; |
346 |
552 |
347 PSDL_PixelFormat = ^TSDL_PixelFormat; |
553 PSDL_PixelFormat = ^TSDL_PixelFormat; |
348 TSDL_PixelFormat = record |
554 TSDL_PixelFormat = record |
349 {$IFDEF SDL2} |
|
350 format: LongWord; |
555 format: LongWord; |
351 palette: Pointer; |
556 palette: Pointer; |
352 BitsPerPixel : Byte; |
557 BitsPerPixel : Byte; |
353 BytesPerPixel: Byte; |
558 BytesPerPixel: Byte; |
354 padding: array[0..1] of Byte; |
559 padding: array[0..1] of Byte; |
603 type_: LongWord; |
775 type_: LongWord; |
604 timestamp: LongWord; |
776 timestamp: LongWord; |
605 end; |
777 end; |
606 |
778 |
607 TSDL_OSEvent = TSDL_CommonEvent; |
779 TSDL_OSEvent = TSDL_CommonEvent; |
608 {$ELSE} |
|
609 TSDL_KeySym = record |
|
610 scancode: Byte; |
|
611 sym: LongWord; |
|
612 modifier: LongWord; |
|
613 unicode: Word; |
|
614 end; |
|
615 |
|
616 TSDL_ActiveEvent = record |
|
617 type_: Byte; |
|
618 gain: Byte; |
|
619 state: Byte; |
|
620 end; |
|
621 |
|
622 TSDL_ResizeEvent = record |
|
623 type_: Byte; |
|
624 w, h: LongInt; |
|
625 end; |
|
626 {$ENDIF} |
|
627 |
780 |
628 TSDL_KeyboardEvent = record |
781 TSDL_KeyboardEvent = record |
629 {$IFDEF SDL2} |
|
630 type_: LongWord; |
782 type_: LongWord; |
631 timestamp: LongWord; |
783 timestamp: LongWord; |
632 windowID: LongWord; |
784 windowID: LongWord; |
633 state, repeat_, padding2, padding3: Byte; |
785 state, repeat_, padding2, padding3: Byte; |
634 {$ELSE} |
|
635 type_, which, state: Byte; |
|
636 {$ENDIF} |
|
637 keysym: TSDL_Keysym; |
786 keysym: TSDL_Keysym; |
638 end; |
787 end; |
639 |
788 |
640 TSDL_MouseMotionEvent = record |
789 TSDL_MouseMotionEvent = record |
641 {$IFDEF SDL2} |
|
642 type_: LongWord; |
790 type_: LongWord; |
643 timestamp: LongWord; |
791 timestamp: LongWord; |
644 windowID: LongWord; |
792 windowID: LongWord; |
645 which, state: LongWord; |
793 which, state: LongWord; |
646 x, y, xrel, yrel: LongInt; |
794 x, y, xrel, yrel: LongInt; |
647 {$ELSE} |
|
648 type_, which, state: Byte; |
|
649 x, y, xrel, yrel: Word; |
|
650 {$ENDIF} |
|
651 end; |
795 end; |
652 |
796 |
653 TSDL_MouseButtonEvent = record |
797 TSDL_MouseButtonEvent = record |
654 {$IFDEF SDL2} |
|
655 type_: LongWord; |
798 type_: LongWord; |
656 timestamp: LongWord; |
799 timestamp: LongWord; |
657 windowID: LongWord; |
800 windowID: LongWord; |
658 which: LongWord; |
801 which: LongWord; |
659 button, state, padding1, padding2: Byte; |
802 button, state, padding1, padding2: Byte; |
660 x, y: LongInt; |
803 x, y: LongInt; |
661 {$ELSE} |
|
662 type_, which, button, state: Byte; |
|
663 x, y: Word; |
|
664 {$ENDIF} |
|
665 end; |
804 end; |
666 |
805 |
667 TSDL_MouseWheelEvent = record |
806 TSDL_MouseWheelEvent = record |
668 type_: LongWord; |
807 type_: LongWord; |
669 {$IFDEF SDL2} |
|
670 timestamp: LongWord; |
808 timestamp: LongWord; |
671 windowID: LongWord; |
809 windowID: LongWord; |
672 which: LongWord; |
810 which: LongWord; |
673 {$ELSE} |
|
674 which: Byte; |
|
675 {$ENDIF} |
|
676 x, y: LongInt; |
811 x, y: LongInt; |
677 end; |
812 end; |
678 |
813 |
679 TSDL_JoyAxisEvent = record |
814 TSDL_JoyAxisEvent = record |
680 {$IFDEF SDL2} |
|
681 type_: LongWord; |
815 type_: LongWord; |
682 timestamp: LongWord; |
816 timestamp: LongWord; |
683 which: LongWord; |
817 which: LongWord; |
684 {$ELSE} |
|
685 type_: Byte; |
|
686 which: Byte; |
|
687 {$ENDIF} |
|
688 axis: Byte; |
818 axis: Byte; |
689 {$IFDEF SDL2} |
|
690 padding1, padding2, padding3: Byte; |
819 padding1, padding2, padding3: Byte; |
691 value: LongInt; |
820 value: LongInt; |
692 padding4: Word; |
821 padding4: Word; |
693 {$ELSE} |
|
694 value: SmallInt; |
|
695 {$ENDIF} |
|
696 end; |
822 end; |
697 |
823 |
698 TSDL_JoyBallEvent = record |
824 TSDL_JoyBallEvent = record |
699 {$IFDEF SDL2} |
|
700 type_: LongWord; |
825 type_: LongWord; |
701 timestamp: LongWord; |
826 timestamp: LongWord; |
702 which: LongWord; |
827 which: LongWord; |
703 {$ELSE} |
|
704 type_: Byte; |
|
705 which: Byte; |
|
706 {$ENDIF} |
|
707 ball: Byte; |
828 ball: Byte; |
708 {$IFDEF SDL2} |
|
709 padding1, padding2, padding3: Byte; |
829 padding1, padding2, padding3: Byte; |
710 {$ENDIF} |
|
711 xrel, yrel: SmallInt; |
830 xrel, yrel: SmallInt; |
712 end; |
831 end; |
713 |
832 |
714 TSDL_JoyHatEvent = record |
833 TSDL_JoyHatEvent = record |
715 {$IFDEF SDL2} |
|
716 type_: LongWord; |
834 type_: LongWord; |
717 timestamp: LongWord; |
835 timestamp: LongWord; |
718 which: LongWord; |
836 which: LongWord; |
719 {$ELSE} |
|
720 type_: Byte; |
|
721 which: Byte; |
|
722 {$ENDIF} |
|
723 hat: Byte; |
837 hat: Byte; |
724 value: Byte; |
838 value: Byte; |
725 {$IFDEF SDL2} |
|
726 padding1, padding2: Byte; |
839 padding1, padding2: Byte; |
727 {$ENDIF} |
|
728 end; |
840 end; |
729 |
841 |
730 TSDL_JoyButtonEvent = record |
842 TSDL_JoyButtonEvent = record |
731 {$IFDEF SDL2} |
843 type_: LongWord; |
732 type_: LongWord; |
844 timestamp: LongWord; |
733 timestamp: LongWord; |
|
734 {$ELSE} |
|
735 type_: Byte; |
|
736 {$ENDIF} |
|
737 which: Byte; |
845 which: Byte; |
738 button: Byte; |
846 button: Byte; |
739 state: Byte; |
847 state: Byte; |
740 {$IFDEF SDL2} |
|
741 padding1: Byte; |
848 padding1: Byte; |
742 {$ENDIF} |
|
743 end; |
849 end; |
744 |
850 |
745 TSDL_QuitEvent = record |
851 TSDL_QuitEvent = record |
746 {$IFDEF SDL2} |
852 type_: LongWord; |
747 type_: LongWord; |
853 timestamp: LongWord; |
748 timestamp: LongWord; |
|
749 {$ELSE} |
|
750 type_: Byte; |
|
751 {$ENDIF} |
|
752 end; |
854 end; |
753 |
855 |
754 TSDL_UserEvent = record |
856 TSDL_UserEvent = record |
755 {$IFDEF SDL2} |
|
756 type_: LongWord; |
857 type_: LongWord; |
757 timestamp: LongWord; |
858 timestamp: LongWord; |
758 windowID: LongWord; |
859 windowID: LongWord; |
759 {$ELSE} |
|
760 type_: Byte; |
|
761 {$ENDIF} |
|
762 code: LongInt; |
860 code: LongInt; |
763 data1, data2: Pointer; |
861 data1, data2: Pointer; |
764 end; |
862 end; |
765 |
863 |
766 PSDL_Event = ^TSDL_Event; |
864 PSDL_Event = ^TSDL_Event; |
767 TSDL_Event = record |
865 TSDL_Event = record |
768 {$IFDEF SDL2} |
|
769 case LongInt of |
866 case LongInt of |
770 SDL_FIRSTEVENT: (type_: LongWord); |
867 SDL_FIRSTEVENT: (type_: LongWord); |
771 SDL_COMMONDEVENT: (common: TSDL_CommonEvent); |
868 SDL_COMMONDEVENT: (common: TSDL_CommonEvent); |
772 SDL_WINDOWEVENT: (window: TSDL_WindowEvent); |
869 SDL_WINDOWEVENT: (window: TSDL_WindowEvent); |
773 SDL_KEYDOWN, |
870 SDL_KEYDOWN, |
774 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
871 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
775 SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent); |
872 SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent); |
776 SDL_TEXTINPUT: (tedit: TSDL_TextInputEvent); |
873 SDL_TEXTINPUT: (text: TSDL_TextInputEvent); |
777 SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); |
874 SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); |
778 SDL_MOUSEBUTTONDOWN, |
875 SDL_MOUSEBUTTONDOWN, |
779 SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); |
876 SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); |
780 SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent); |
877 SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent); |
781 SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); |
878 SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); |
1009 function SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): Boolean; cdecl; external SDLLibName; |
1084 function SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): Boolean; cdecl; external SDLLibName; |
1010 |
1085 |
1011 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName; |
1086 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName; |
1012 function SDL_SetHint(name, value: PChar): Boolean; cdecl; external SDLLibName; |
1087 function SDL_SetHint(name, value: PChar): Boolean; cdecl; external SDLLibName; |
1013 procedure SDL_StartTextInput; cdecl; external SDLLibName; |
1088 procedure SDL_StartTextInput; cdecl; external SDLLibName; |
|
1089 procedure SDL_StopTextInput; cdecl; external SDLLibName; |
1014 |
1090 |
1015 function SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; minType, maxType: LongWord): LongInt; cdecl; external SDLLibName; |
1091 function SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; minType, maxType: LongWord): LongInt; cdecl; external SDLLibName; |
1016 |
1092 |
1017 function SDL_AllocFormat(format: LongWord): PSDL_PixelFormat; cdecl; external SDLLibName; |
1093 function SDL_AllocFormat(format: LongWord): PSDL_PixelFormat; cdecl; external SDLLibName; |
1018 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); cdecl; external SDLLibName; |
1094 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); cdecl; external SDLLibName; |
1019 {$ELSE} |
|
1020 function SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; mask: LongWord): LongInt; cdecl; external SDLLibName; |
|
1021 |
|
1022 function SDL_EnableUNICODE(enable: LongInt): LongInt; cdecl; external SDLLibName; |
|
1023 function SDL_EnableKeyRepeat(timedelay, interval: LongInt): LongInt; cdecl; external SDLLibName; |
|
1024 function SDL_VideoDriverName(namebuf: PChar; maxlen: LongInt): PChar; cdecl; external SDLLibName; |
|
1025 {$ENDIF} |
|
1026 |
1095 |
1027 |
1096 |
1028 function SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; |
1097 function SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; |
1029 function SDL_GetKeyName(key: LongWord): PChar; cdecl; external SDLLibName; |
1098 function SDL_GetKeyName(key: TSDL_Keycode): PChar; cdecl; external SDLLibName; |
1030 function SDL_GetScancodeName(key: LongWord): PChar; cdecl; external SDLLibName; |
1099 function SDL_GetScancodeName(key: TSDL_Scancode): PChar; cdecl; external SDLLibName; |
1031 function SDL_GetKeyFromScancode(key: LongWord): LongInt; cdecl; external SDLLibName; |
1100 function SDL_GetKeyFromScancode(key: TSDL_Scancode): TSDL_Keycode; cdecl; external SDLLibName; |
1032 |
1101 // SDL2 functions has some additional functions (not listed here) for keycode/scancode translation |
1033 |
1102 |
1034 procedure SDL_PumpEvents; cdecl; external SDLLibName; |
1103 procedure SDL_PumpEvents; cdecl; external SDLLibName; |
1035 function SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
1104 function SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
1036 function SDL_WaitEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
1105 function SDL_WaitEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
1037 procedure SDL_SetEventFilter(filter: TSDL_EventFilter); cdecl; external SDLLibName; |
1106 procedure SDL_SetEventFilter(filter: TSDL_EventFilter); cdecl; external SDLLibName; |
1038 |
1107 |
1039 function SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName; |
1108 function SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName; |
1040 procedure SDL_WarpMouse(x, y: Word); {$IFDEF SDL2}inline{$ELSE}cdecl; external SDLLibName{$ENDIF}; |
1109 procedure SDL_WarpMouse(x, y: Word); inline; |
1041 function SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName {$IFDEF SDL2} name 'SDL_GetKeyboardState'{$ENDIF}; |
1110 |
|
1111 function SDL_GetKeyboardState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName; |
1042 |
1112 |
1043 procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask : Byte); cdecl; external SDLLibName; |
1113 procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask : Byte); cdecl; external SDLLibName; |
1044 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName; |
1114 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName; |
1045 function SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName; |
1115 function SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName; |
1046 |
1116 |
1047 |
1117 |
1048 (* remember to mark the threaded functions as 'cdecl; export;' |
1118 (* remember to mark the threaded functions as 'cdecl; export;' |
1049 (or have fun debugging nil arguments) *) |
1119 (or have fun debugging nil arguments) *) |
1050 function SDL_CreateThread(fn: Pointer; {$IFDEF SDL2}name: PChar;{$ENDIF} data: Pointer): PSDL_Thread; cdecl; external SDLLibName; |
1120 function SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; external SDLLibName; |
1051 procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName; |
1121 procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName; |
1052 procedure SDL_KillThread(thread: PSDL_Thread); cdecl; external SDLLibName; |
|
1053 |
1122 |
1054 function SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName; |
1123 function SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName; |
1055 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName; |
1124 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName; |
1056 function SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName {$IFNDEF SDL2}name 'SDL_mutexP'{$ENDIF}; |
1125 function SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName; |
1057 function SDL_UnlockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName {$IFNDEF SDL2}name 'SDL_mutexV'{$ENDIF}; |
1126 function SDL_UnlockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName; |
1058 |
1127 |
1059 function SDL_CreateCond: PSDL_cond; cdecl; external SDLLibName; |
1128 function SDL_CreateCond: PSDL_cond; cdecl; external SDLLibName; |
1060 procedure SDL_DestroyCond(cond: PSDL_cond); cdecl; external SDLLibName; |
1129 procedure SDL_DestroyCond(cond: PSDL_cond); cdecl; external SDLLibName; |
1061 function SDL_CondSignal(cond: PSDL_cond): LongInt; cdecl; external SDLLibName; |
1130 function SDL_CondSignal(cond: PSDL_cond): LongInt; cdecl; external SDLLibName; |
1062 function SDL_CondBroadcast(cond: PSDL_cond): LongInt; cdecl; external SDLLibName; |
1131 function SDL_CondBroadcast(cond: PSDL_cond): LongInt; cdecl; external SDLLibName; |
1174 procedure SDLNet_TCP_Close(sock: PTCPsocket); cdecl; external SDL_NetLibName; |
1243 procedure SDLNet_TCP_Close(sock: PTCPsocket); cdecl; external SDL_NetLibName; |
1175 procedure SDLNet_FreeSocketSet(_set: PSDLNet_SocketSet); cdecl; external SDL_NetLibName; |
1244 procedure SDLNet_FreeSocketSet(_set: PSDLNet_SocketSet); cdecl; external SDL_NetLibName; |
1176 function SDLNet_AddSocket(_set: PSDLNet_SocketSet; sock: PTCPSocket): LongInt; cdecl; external SDL_NetLibName; |
1245 function SDLNet_AddSocket(_set: PSDLNet_SocketSet; sock: PTCPSocket): LongInt; cdecl; external SDL_NetLibName; |
1177 function SDLNet_CheckSockets(_set: PSDLNet_SocketSet; timeout: LongInt): LongInt; cdecl; external SDL_NetLibName; |
1246 function SDLNet_CheckSockets(_set: PSDLNet_SocketSet; timeout: LongInt): LongInt; cdecl; external SDL_NetLibName; |
1178 |
1247 |
|
1248 // SDL 2 clipboard functions |
|
1249 function SDL_HasClipboardText(): Boolean; cdecl; external SDLLibName; |
|
1250 // returns nil if memory for clipboard contents copy couldn't be allocated |
|
1251 function SDL_GetClipboardText(): PChar; cdecl; external SDLLibName; |
|
1252 // returns 0 on success or negative error number on failure |
|
1253 function SDL_SetClipboardText(const text: PChar): LongInt; cdecl; external SDLLibName; |
1179 |
1254 |
1180 procedure SDLNet_Write16(value: Word; buf: Pointer); |
1255 procedure SDLNet_Write16(value: Word; buf: Pointer); |
1181 procedure SDLNet_Write32(value: LongWord; buf: Pointer); |
1256 procedure SDLNet_Write32(value: LongWord; buf: Pointer); |
1182 function SDLNet_Read16(buf: Pointer): Word; |
1257 function SDLNet_Read16(buf: Pointer): Word; |
1183 function SDLNet_Read32(buf: Pointer): LongWord; |
1258 function SDLNet_Read32(buf: Pointer): LongWord; |
1184 |
1259 |
1185 implementation |
1260 implementation |
1186 {$IFDEF SDL2} |
|
1187 uses uStore; |
1261 uses uStore; |
1188 |
1262 |
1189 // for sdl1.2 we directly call SDL_WarpMouse() |
1263 // for sdl1.2 we directly call SDL_WarpMouse() |
1190 // for sdl2 we provide a SDL_WarpMouse() which calls the right SDL_WarpMouseInWindow() function |
1264 // for sdl2 we provide a SDL_WarpMouse() which calls the right SDL_WarpMouseInWindow() function |
1191 // this has the advantage of reducing 'uses' and 'ifdef' statements |
1265 // this has the advantage of reducing 'uses' and 'ifdef' statements |
1192 // (SDLwindow is a private member of uStore module) |
1266 // (SDLwindow is a private member of uStore module) |
1193 procedure SDL_WarpMouse(x, y: Word); inline; |
1267 procedure SDL_WarpMouse(x, y: Word); inline; |
1194 begin |
1268 begin |
1195 WarpMouse(x, y); |
1269 WarpMouse(x, y); |
1196 end; |
1270 end; |
1197 {$ENDIF} |
|
1198 |
1271 |
1199 function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
1272 function SDL_MustLock(Surface: PSDL_Surface): Boolean; |
1200 begin |
1273 begin |
1201 SDL_MustLock:= |
1274 SDL_MustLock:= |
1202 {$IFDEF SDL2} |
|
1203 ((surface^.flags and SDL_RLEACCEL) <> 0) |
1275 ((surface^.flags and SDL_RLEACCEL) <> 0) |
1204 {$ELSE} |
|
1205 ( surface^.offset <> 0 ) or (( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0) |
|
1206 {$ENDIF} |
|
1207 end; |
1276 end; |
1208 |
|
1209 {$IFNDEF SDL_MIXER_NEWER} |
|
1210 function Mix_Init(flags: LongInt): LongInt; inline; |
|
1211 begin |
|
1212 Mix_Init:= flags; |
|
1213 end; |
|
1214 |
|
1215 procedure Mix_Quit; inline; |
|
1216 begin |
|
1217 end; |
|
1218 {$ENDIF} |
|
1219 |
|
1220 {$IFNDEF SDL_IMAGE_NEWER} |
|
1221 function IMG_Init(flags: LongInt): LongInt; inline; |
|
1222 begin |
|
1223 IMG_Init:= flags; |
|
1224 end; |
|
1225 |
|
1226 procedure IMG_Quit; inline; |
|
1227 begin |
|
1228 end; |
|
1229 {$ENDIF} |
|
1230 |
1277 |
1231 procedure SDLNet_Write16(value: Word; buf: Pointer); |
1278 procedure SDLNet_Write16(value: Word; buf: Pointer); |
1232 begin |
1279 begin |
1233 PByteArray(buf)^[1]:= value; |
1280 PByteArray(buf)^[1]:= value; |
1234 PByteArray(buf)^[0]:= value shr 8 |
1281 PByteArray(buf)^[0]:= value shr 8 |