public void render(IGraphics g) { if (!Visible) return; g.pushClip(); g.clipRect(WindowX, WindowY, WindowW, WindowH); { int bx = CMath.cycNum(X, 0, MapW) / CellW; int by = CMath.cycNum(Y, 0, MapH) / CellH; int dx = CMath.cycNum(X, 0, MapW) % CellW; int dy = CMath.cycNum(Y, 0, MapH) % CellH; int cpx = WindowX - dx; int cpy = WindowY - dy; for (int y = 0; y < WindowBH; y++) { for (int x = 0; x < WindowBW; x++) { Map.renderCell( g, cpx + x * CellW, cpy + y * CellH, CMath.cycNum(bx, x, MapBW), CMath.cycNum(by, y, MapBH)); } } } g.popClip(); }