Advertisement
Redxone

[CC - GameMap API] BuffPixel API (Concept)

Jan 25th, 2017
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.96 KB | None | 0 0
  1. --]] Lua buffer map API ideas
  2.  
  3.  
  4. getMap(w, h) -- Returns map in table format
  5. -------------
  6.     --]] Map Functions -- "FF*", where FF is text color, then back color, and * is the graphic
  7.         changePixelGraphic(x,y,to) -- Changes a pixels graphic at an X and Y to a specific string "Text-Back-Str"
  8.         setSolid(x,y,tf)       -- Sets a pixel at X, Y to be solid or not (map[y][x].solid = tf)
  9.         getRegionMap(fx,fy,tx,ty)  -- Returns a map of pixels from a specific region
  10.         setPixelAttribute(x,y,att) -- Concatenates att table onto the Pixels table at X, Y
  11.         getPixelAttribute(x,y,name)-- Returns Attribute by name
  12.         setPixel(x,y,g,s)      -- sets pixel at x, y to graphic - g and solid - s
  13.         getPixel(x,y)          -- returns entire pixel at x and y
  14.         drawPixel(x,y)             -- draws pixel from map x, y
  15.         drawPixelAt(x,y,sx,sy)     -- draws pixel from map x, y at screen sx, sy
  16. ---------------
  17. createCamera(fx,fy) -- Returns camera table with focal pointed offsets of - fx and fy      
  18.     --]] Camera Functions -- store local buffer    
  19.         render(map,mx,my,ox,oy) -- render map starting ox, oy and ending at mx+ox and my+oy, viewx = ox, viewy = oy, vieww = mx, viewh = my : checks buffer for smart rendering
  20.         updateView(map,cx,cy)   -- Updates cam view by adding cx and cy to it, renders
  21.         clearBuffer()       -- Clears the buffer
  22.         isOutsideView(x,y)  -- Check view variables to see of coord is outside view
  23.         setBuffer(buff)     -- Sets buffer table to, buff    
  24. ---------------
  25. Transparent pixel utils - render used to draw pixels unrelated to the table map
  26. -]] Transparent pixel functions -- Returns renderer
  27.     setProjection(x,y) -- sets starting point for adding offsets too
  28.     addProjection(xo,yo) -- adds xo, yo to projection
  29.     drawTPixel(x,y,g) -- draws pixel at x, y with g as graphic
  30.     moveTPixel(map,xo,yo,g,a) -- takes map and draws map[y][x] at projection then draws g, at projection +xo, +yo boolean a is add offset to projection.
  31.     clearTPixel(map,x,y)      -- redraws x, y to map[y][x]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement