liko-12.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. ==========================================================================================
  2. LIKO-12 V0.0.1 PRE
  3. https://github.com/RamiLego4Game/LIKO-12
  4. Licensed under GPL-3, see LICENSE file for more info
  5. Author: RamiLego4Game // ramilego4game@gmail.com
  6. Contributers:
  7. technomancy: The editor console code.
  8. LIKO-12 is built with:
  9. L�VE Framework: http://love2d.org/
  10. ==========================================================================================
  11. Welcome to LIKO-12:
  12. LIKO-12 is a PICO-8 clone but with extra abilities, different api and bigger screen width.
  13. We are working on this because PICO-8 is not available for free, and to create a clone
  14. without pointless limits.
  15. What's PICO-8 ??
  16. - PICO-8 is a fantasy console for making, sharing and playing tiny games and other computer
  17. programs. When you turn it on, the machine greets you with a shell for typing in Lua programs
  18. straight away and provides simple built-in tools for creating sprites, maps and sound.
  19. - LIKO-12 comes with a terminal, lua console, sprites editor and a code editor.
  20. It also comes with a modified PICO-8 font that have small letters support.
  21. - So you can basicly create spritesheets, and games using this console.
  22. :: Keys
  23. Escape: Quit running cart or switch between editors and the terminal.
  24. Mouse Wheel: Move up/down/left/right the cursor in the code editor.
  25. :: Specs
  26. Display: 192x128, fixed 16 colour palette (PICO-8 pallete)
  27. Input: Full access to Mouse, Touch and Keyboard !
  28. SpriteSheet: 288 sprite (24x12)
  29. Code: LuaJit 5.1
  30. L�VE: 0.10.1
  31. Runs on: Windows, Linux, Mac, Android, iOS, RaspberryPi (Check PiLove).
  32. :: Bugs/Crashes reports
  33. Please report those at the github issues tracker:
  34. https://github.com/RamiLego4Game/LIKO-12/issues
  35. :: Hello World
  36. After LIKO-12 boots, try loading the hello world builtin cart by typing those commands in the terminal:
  37. load helloworld
  38. run
  39. Try to to press and drag anywhere on the screen.
  40. To quit the cart press escape key, now to view the source code/ sprites of the cart press escape key again.
  41. Now in the sprites editor try to edit the hello world sprite then press escape to return to the terminal and type run.
  42. Awesome right ?
  43. To save your cart type ( you may replace myhelloworld with any name you like ):
  44. save myhelloworld
  45. :: Demo Carts
  46. Here's a list of the built-in demo carts the you can load, edit, run and save !
  47. tictactoe A 2 players tictactoe game made by RamiLego4Game.
  48. helloworld The helloworld example.
  49. noise Fill the screen with random colors.
  50. To run a cart, open LIKO-12 terminal and type:
  51. load tictactoe
  52. run
  53. Press escape to stop the cart, and once more to enter editing mode.
  54. :: Exporters / Importers
  55. To import or export the spritesheet as a .png:
  56. export spritesheet
  57. import spritesheet
  58. :: Editing the internal spritessheet
  59. To edit the internal spritesheet type in the terminal:
  60. import editorsheet
  61. Edit the sheet as you like (You can edit the cursor too)
  62. export editorsheet
  63. reload
  64. Have fun hacking this :3
  65. :: Terminal Commands
  66. COMMANDS <REQUIRED> [OPTIONAL]
  67. HELP: Shows help info
  68. NEW: Clears the memory
  69. RELOAD: Reloads the editorsheet
  70. RUN: Runs the loaded cart
  71. SAVE <NAME>: Saves the current cart
  72. LOAD <NAME>: Loads a cart
  73. IMPORT <PATH>: Imports a spritesheet
  74. EXPORT <PATH>: Exports the current loaded spritesheet
  75. CLS: Clears the terminal
  76. VER: Shows LIKO-12 Title
  77. :: Screen Rendering
  78. LIKO-12 has non clearing canvas rendering system this means:
  79. - You don't have to redraw everything when resizeing thr lk12 window
  80. - The screen doesn't clears every frame
  81. - You can draw to the screen anywhere in the code
  82. Note: the everything called before _startup() will be cleared.
  83. :: Getting Started
  84. To get started do the hello world tutorial then load and play demo games.
  85. After that let's start:
  86. Load the helloworld cart, then true to edit the logo and run thr game.
  87. Go back to the editor and switch to the code editor (The [] tab)
  88. From here you can start by reading the demos code
  89. How carts work:
  90. The game code get's excuted to overwrite the global callbacks
  91. Then the screen is cleared with black color
  92. After that the _startup callback is called so the cart draws
  93. Finally whenever input happens the relevant callbacks are called so the game draws new content.
  94. On update the _update callback is called with delta time.
  95. SpriteSheet:
  96. Before running game code, the spritesheet is loaded to the globals, so the game gets access to it's spritesheet
  97. So now read the demo games, and be sure to check the API documentation bellow.
  98. Console Editor Tab:
  99. This is a work in progress feature, don't use it for now..
  100. ==========================================================================================
  101. API
  102. ==========================================================================================
  103. :: Callbacks
  104. You should overwrite the callbacks you want to use, ex: function _startup() end
  105. _startup
  106. This function is called at the initialization of your game.
  107. Start your game drawing from here, because any draw calls called when compiling your game code are cleared.
  108. _update dt
  109. This function is called everyframe.
  110. - DT (Number): The delta time between _update calls in seconds.
  111. _mpress x,y,b,it
  112. This function is called when a mouse button is pressed.
  113. - x,y (Numbers): The X and Y position of the mouse.
  114. - b (Number): The pressed mouse button.
  115. - it (Boolean): (istouch) if the mouse press is in fact a touch press.
  116. _mmove x,y,dx,dy,it,iw
  117. This function is called whenever the mouse gets moved.
  118. - x,y (Numbers): The X and Y position of the mouse.
  119. - dx,dy (Numbers): How much the mouse has moved in each direction.
  120. - it (Boolean): (istouch) if the mouse press is in fact a touch move.
  121. - iw (Boolean): (iswheel) if true then the x,y are how much the mouse wheel has moved.
  122. _mrelease x,y,b,it
  123. This function is called when a mouse button is released.
  124. - x,y (Numbers): The X and Y position of the mouse.
  125. - b (Number): The released mouse button.
  126. - it (Boolean): (istouch) if the mouse press is in fact a touch release.
  127. _tpress id,x,y,dx,dy,p
  128. This function is called when the screen is touched.
  129. - id (Light-Number): The id of the touch.
  130. - x,y (Numbers): The X and Y position of the touch.
  131. - dx,dy (Numbers): How much the touch has moved in each direction, this should be always zero.
  132. - p (Number): (pressure) The pressure of the touch.
  133. _tmove id,x,y,dx,dy,p
  134. This function is called when a screen touch is moved.
  135. - id (Light-Number): The id of the touch.
  136. - x,y (Numbers): The X and Y position of the touch.
  137. - dx,dy (Numbers): How much the touch has moved in each direction.
  138. - p (Number): (pressure) The pressure of the touch.
  139. _trelease id,x,y,dx,dy,p
  140. This function is called when a screen touch is released.
  141. - id (Light-Number): The id of the touch.
  142. - x,y (Numbers): The X and Y position of the touch.
  143. - dx,dy (Numbers): How much the touch has moved in each direction.
  144. - p (Number): (pressure) The pressure of the touch.
  145. _kpress k, sc, ir
  146. This function is called when a keyboard key is pressed.
  147. - k (String [KeyConstant]): The key that has been pressed.
  148. - sc (Number): The scancode of the pressed key.
  149. - ir (Boolean): (IsRepeat) See keyrepeat function.
  150. _krelease k, sc
  151. This function is called when a keyboard key is released.
  152. - k (String [KeyConstant]): The key that has been released.
  153. - sc (Number): The scancode of the released key.
  154. _tinput t
  155. This function is called when text is inputted.
  156. - t (String): The text inputted.
  157. :: Graphics
  158. color [c]
  159. Sets the current drawing color to the given color or black
  160. - c [Number]: The new color.
  161. clear [c]
  162. Clears the screen and fills it with the given color black
  163. - c [Number]: The color to fill with
  164. stroke [width]
  165. Sets the width of the lines and points to the given width or 1
  166. - width [Number]: The new width
  167. point/points x1,y1,[x2,y2,...],[c]
  168. Draws the give points, if the number of the given args is odd then last one is set as the color.
  169. - x,y,... (Numbers): The points locations
  170. - c [Number]: The color to set to
  171. line/lines x1,y1,x2,y2,[x3,y3,...],[c]
  172. Draws lines connecting the given points, if the number of the given args is odd then the last one is set as the color.
  173. - x,y,... (Numbers): The points locations
  174. - c [Number]: The color to set to
  175. circle/circle_line x,y,r,[c]
  176. Draws a circle at the given position
  177. - x,y (Numbers): The center pos of the circle
  178. - r (Number): The radius of the circle
  179. - c [Number]: The color to set to
  180. rect/rect_line x,y,w,h,[c]
  181. Draws a rectangle with the given specifications
  182. - x,y (Numbers): The position of the topleft corner of thr rect.
  183. - w,h (Numbers): The width and height of the rectangle.
  184. - c [Number]: The color to set to
  185. print/print_grid text,[x],[y]
  186. Prints text at a specific location in the screen, be sure to set the color using color()
  187. print_grid is alligned ta 8x8 cell grid.
  188. - text (String or Table): The text to print, it can be a table: {"text",{r,g,b,a}}
  189. - x,y [Numbers]: The position to print at.
  190. Sprite sprid, x,y, [r], [sx],[sy], [sprsheet]
  191. Draws a specific sprite at the given pos.
  192. - sprid (Number): The sprite id as shown in the sprite editor
  193. - x,y (Numbers): The topleft corner position of the sprite.
  194. - r [Number]: The rotation in radian.
  195. - sx,sy [Numbers]: The sprite width and hight multiplying factor.
  196. - sprsheet [liko12.spriteSheet]: The spritesheet containing the sprite (advanced users only)
  197. SpriteGroup sprid, x,y, w,h, [sx],[sy], [sprsheet]
  198. Draws a group of sprites at the given pos.
  199. - sprid (Number): The id of thr top left sprite in the group.
  200. - x,y (Numbers): The topleft corner position
  201. - w,w (Numbers): The number of the sprites in width and height
  202. - sx,sy [Numbers]: The sprite width and hight multiplying factor.
  203. - sprsheet [liko12.spriteSheet]: The spritesheet containing the sprite (advanced users only)
  204. SpriteMap
  205. The carts spritesheet
  206. :: Math
  207. ostime
  208. The default lua os.time function
  209. floor
  210. The original lua math.floor function
  211. rand_seed
  212. the default love.math.setRandomSeed function
  213. rand
  214. the default love.math.random function
  215. :: GUI
  216. isInRect x,y,rect
  217. Returns true is the point is in the rect.
  218. - x,y (Numbers): The x and y positions of the point.
  219. - rect (Table): Rect table: {x,y,w,h}
  220. + (Boolean): is in rect.
  221. whereInGrid x,y,grid
  222. Returns false if the point is not in the grid at all.
  223. Return cellx, celly if the point is in the grid.
  224. - x,y (Numbers): the x and y posotions of the point to test.
  225. - grid (Table): The grid config {x,y,cellw,cellh,w,h}
  226. + cx,cy (Numbers): The position in the grid.
  227. :: Misc
  228. keyrepeat state
  229. To enable _kpress isrepeat function
  230. showKeyboard state
  231. To show the keyboard on mobile devices.
  232. isMobile
  233. Returns true if liko12 is running on a mobile device
  234. Image, ImageData, SpriteSheet, setCursor, newCursor is not documented here, check api.lua for info about them