Handmade.pp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. unit handmade;
  2. interface
  3. uses
  4. ctypes, nds9, scrolling;
  5. procedure HandMadeTiles();
  6. var
  7. tiles: array [0..(64*4)-1] of cuint8 =
  8. (
  9. //Tile 0: transparent tile
  10. 0,0,0,0,0,0,0,0,
  11. 0,0,0,0,0,0,0,0,
  12. 0,0,0,0,0,0,0,0,
  13. 0,0,0,0,0,0,0,0,
  14. 0,0,0,0,0,0,0,0,
  15. 0,0,0,0,0,0,0,0,
  16. 0,0,0,0,0,0,0,0,
  17. 0,0,0,0,0,0,0,0,
  18. //Tile 1: solid tile using color index 1
  19. 1,1,1,1,1,1,1,1,
  20. 1,1,1,1,1,1,1,1,
  21. 1,1,1,1,1,1,1,1,
  22. 1,1,1,1,1,1,1,1,
  23. 1,1,1,1,1,1,1,1,
  24. 1,1,1,1,1,1,1,1,
  25. 1,1,1,1,1,1,1,1,
  26. 1,1,1,1,1,1,1,1,
  27. //Tile 2: solid tile using color index 2
  28. 2,2,2,2,2,2,2,2,
  29. 2,2,2,2,2,2,2,2,
  30. 2,2,2,2,2,2,2,2,
  31. 2,2,2,2,2,2,2,2,
  32. 2,2,2,2,2,2,2,2,
  33. 2,2,2,2,2,2,2,2,
  34. 2,2,2,2,2,2,2,2,
  35. 2,2,2,2,2,2,2,2,
  36. //Tile 3: smily face tile
  37. 0,0,1,1,1,1,0,0,
  38. 0,1,1,1,1,1,1,0,
  39. 1,1,2,1,1,2,1,1,
  40. 1,1,1,1,1,1,1,1,
  41. 1,1,1,1,1,1,1,1,
  42. 1,2,1,1,1,1,2,1,
  43. 0,1,2,2,2,2,1,0,
  44. 0,0,1,1,1,1,0,0
  45. );
  46. map32x32: array [0..(32*32)-1] of cuint16 =
  47. (
  48. 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  79. 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
  80. );
  81. palette: array [0..2] of cuint16;
  82. // = (
  83. // RGB15(0,0,0),
  84. // RGB15(31,31,0),
  85. // RGB15(0,31,0)
  86. //);
  87. implementation
  88. procedure HandMadeTiles();
  89. var
  90. bg: cint;
  91. begin
  92. videoSetMode(MODE_0_2D);
  93. vramSetBankA(VRAM_A_MAIN_BG);
  94. bg := bgInit(0, BgType_Text8bpp, BgSize_T_256x256, 0,1);
  95. dmaCopy(@tiles, bgGetGfxPtr(bg), sizeof(tiles));
  96. dmaCopy(@map32x32, bgGetMapPtr(bg), sizeof(map32x32));
  97. dmaCopy(@palette, BG_PALETTE, sizeof(palette));
  98. scroll(bg, 256, 256);
  99. end;
  100. initialization
  101. palette[0] := RGB15(0,0,0);
  102. palette[1] := RGB15(31,31,0);
  103. palette[2] := RGB15(0,31,0);
  104. end.