Ejemplo n.º 1
0
int lh_internal(lua_State *L) {
  checkArg(L, 3, "internal");

  P = new InternalProcess(luaO(1, Screen), luaO(2, Font), luaStr(3));
  
  return retObjectEv(L, P);
  }
Ejemplo n.º 2
0
int lh_sethydrabox(lua_State *L) {
  checkArg(L, 2, "sethydrabox");
  extern SDL_Surface *hydrabox, *hydraheads;
  extern int *hydraboxc;
  Image *I1 = luaO(1, Image);
  Image *I2 = luaO(2, Image);
  hydrabox = I1->s;
  hydraheads = I2->s;
  hydraboxc = &I1->changes;
  return 0;
  }
Ejemplo n.º 3
0
int lh_saveimage(lua_State *L) {
  checkArg(L, 2, "saveimage");
  Image *o = luaO(1, Image);
  if(useGL(o)) screenshotGL(luaStr(2));
  else SDL_SaveBMP(o->s, luaStr(2));
  return 0;
  }
Ejemplo n.º 4
0
int lh_imggetsize(lua_State *L) {
  checkArg(L, 1, "imggetsize");
  Image *img = luaO(1, Image);
  lua_newtable(L);
  setfield(L, "x", img->s->w);
  setfield(L, "y", img->s->h);
  return 1;
  }
Ejemplo n.º 5
0
int lh_isosizes(lua_State *L) {
  checkArg(L, 1, "isosizes");
  IsoParam *P = luaO(1, IsoParam);
  lua_newtable(L);
  setfield(L, "floor", P->floor);
  setfield(L, "x", P->sx);
  setfield(L, "y", P->sy);
  return 1;
  }
Ejemplo n.º 6
0
int lh_hydramain(lua_State *L) {
  checkArg(L, 2, "hydramain");

  InternalProcess *P = luaO(1, InternalProcess);
  noteye_setinternal(P, L, 2);

  P->exitcode = hydraMain(gargc, gargv);
  P->isActive = false;

  return 0;
  }
Ejemplo n.º 7
0
int lh_getpixel(lua_State *L) {
  checkArg(L, 3, "getpixel");

  Image *srcI = luaO(1, Image);
  int srcX = luaInt(2);
  int srcY = luaInt(3);
#ifdef OPENGL
  if(useGL(srcI)) return retInt(L, getpixelGL(srcX, srcY));
#endif
  srcI->setLock(true);
  int res = qpixel(srcI->s, srcX, srcY);
  return retInt(L, res);
  }
Ejemplo n.º 8
0
int lh_imgcopy(lua_State *L) {
  checkArg(L, 8, "fillimage");

  Image *srcI = luaO(1, Image);
  int srcX = luaInt(2);
  int srcY = luaInt(3);

  Image *tgtI = luaO(4, Image);
  int tgtX = luaInt(5);
  int tgtY = luaInt(6);
  
  int six = luaInt(7);
  int siy = luaInt(8);
  
  srcI->setLock(false);
  tgtI->setLock(false);
  
  SDL_Rect srcR; srcR.x = srcX; srcR.y = srcY; srcR.w = six; srcR.h = siy;
  SDL_Rect tgtR; tgtR.x = tgtX; tgtR.y = tgtY; 
  
  SDL_BlitSurface(srcI->s, &srcR, tgtI->s, &tgtR);
  tgtI->changes++;
  return 0;
  }
Ejemplo n.º 9
0
int lh_setpixel(lua_State *L) {
  checkArg(L, 4, "setpixel");

  Image *srcI = luaO(1, Image);
  int srcX = luaInt(2);
  int srcY = luaInt(3);
  
#ifdef OPENGL
  if(useGL(srcI)) return 0;
#endif

  srcI->setLock(true);
  qpixel(srcI->s, srcX, srcY) = luaInt(4);
  srcI->changes++;
  return 0;
  }
Ejemplo n.º 10
0
int lh_fillimage(lua_State *L) {
  checkArg(L, 6, "fillimage");
  SDL_Rect rect;
  rect.x = luaInt(2);
  rect.y = luaInt(3);
  rect.w = luaInt(4);
  rect.h = luaInt(5);
  int col = luaInt(6);
  Image *img = luaO(1,Image);
#ifdef OPENGL
  if(useGL(img)) fillRectGL(rect.x, rect.y, rect.w, rect.h, col); else
#endif
  SDL_FillRect(img->s, &rect, col);
  img->changes++;
  return 0;
  }
Ejemplo n.º 11
0
int lh_setfont(lua_State *L) {
  checkArg(L, 2, "setfont");
  Font *f = luaO(2, Font);
  Process *p = dluaO(1, Process);
  if(p) {
    p->f = f;
    }
  Screen *s= p ? p->s : dluaO(1, Screen);
  if(s) {
    for(int y=0; y<s->sx * s->sy; y++)
      s->v[y] = tileSetFont(s->v[y], f);
    }
  Tile *t = dluaO(1, Tile);
  if(t) return retInt(L, tileSetFont(t->id, f));
  return 0;
  }
Ejemplo n.º 12
0
int lh_iso(lua_State *L) {
  checkArg(L, 2, "isoproject");
  IsoParam *P = luaO(2, IsoParam);
  
  int t0;
  int ti = luaInt(1);
  t0 = addFreeform(distill(ti, spIFloor), P->Floor);
  t0 = addMerge(t0, addFreeform(addRecolor(distill(ti, spIWallL), 0xFF808080, recMult), P->WalL), false);
  t0 = addMerge(t0, addFreeform(addRecolor(distill(ti, spIWallR), 0xFFC0C0C0, recMult), P->WalR), false);
//t0 = addMerge(t0, addFreeform(distill(ti, spIWallL), P->WalL), false);
//t0 = addMerge(t0, addFreeform(distill(ti, spIWallR), P->WalR), false);
  t0 = addMerge(t0, addFreeform(distill(ti, spICeil), P->Ceil), false);
  t0 = addMerge(t0, addFreeform(distill(ti, spIItem), P->Item), false);
  
  return retInt(L, t0);
  // return retInt(L, renderAsIso(luaInt(1), spIFloor | spIItem | spIWallL | spIWallR | spICeil, luaO(2, IsoParam)));
  }
Ejemplo n.º 13
0
int lh_imagetitle(lua_State *L) {
  checkArg(L, 2, "imagetitle");
  luaO(1, Image) -> title = luaStr(2);
  return 0;
  }