My Marlin configs for Fabrikator Mini and CTC i3 Pro B
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

invaders.h 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. #include "types.h"
  24. #define INVASION_SIZE 3
  25. #if INVASION_SIZE == 3
  26. #define INVADER_COLS 5
  27. #elif INVASION_SIZE == 4
  28. #define INVADER_COLS 6
  29. #else
  30. #define INVADER_COLS 8
  31. #undef INVASION_SIZE
  32. #define INVASION_SIZE 5
  33. #endif
  34. #define INVADER_ROWS INVASION_SIZE
  35. #define INVADER_COL_W 14
  36. #define INVADER_H 8
  37. #define INVADER_ROW_H (INVADER_H + 2)
  38. typedef struct { int8_t x, y, v; } laser_t;
  39. typedef struct {
  40. pos_t pos;
  41. uint8_t cannons_left;
  42. int8_t cannon_x;
  43. laser_t bullet[10], laser, explod;
  44. int8_t dir, leftmost, rightmost, botmost;
  45. uint8_t count, quit_count, blink_count;
  46. uint8_t bugs[INVADER_ROWS], shooters[(INVADER_ROWS) * (INVADER_COLS)];
  47. int8_t ufox, ufov;
  48. bool game_blink;
  49. int8_t laser_col() { return ((laser.x - pos.x) / (INVADER_COL_W)); };
  50. int8_t laser_row() { return ((laser.y - pos.y + 2) / (INVADER_ROW_H)); };
  51. } invaders_data_t;
  52. class InvadersGame : MarlinGame { public: static void enter_game(), game_screen(); };
  53. extern InvadersGame invaders;