Beispiel #1
0
ssize_t
Stream::Write(const void *src, size_t size)
{
	off_t curPos = Position();
	ssize_t wrote = WriteAt(curPos, src, size);
	if (wrote > 0)
		Seek(wrote, SEEK_CUR);
	return wrote;
}
Beispiel #2
0
void
VTConsole::SetCursor(int32 x, int32 y)
{
	char buffer[8];
	x = MIN(79, MAX(0, x));
	y = MIN(24, MAX(0, y));
	int len = snprintf(buffer, sizeof(buffer),
		"\033[%" B_PRId32 ";%" B_PRId32 "H", y, x);
	WriteAt(NULL, 0LL, buffer, len);
}
void
VTConsole::SetCursor(int32 x, int32 y)
{
	char buff[] = "\033Y  ";
	x = MIN(79,MAX(0,x));
	y = MIN(24,MAX(0,y));
	buff[3] += (char)x;
	buff[2] += (char)y;
	WriteAt(NULL, 0LL, buff, 4);
}
Beispiel #4
0
// Write
ssize_t
BPositionIO::Write(const void *buffer, size_t size)
{
	off_t curPos = Position();
	ssize_t result = WriteAt(curPos, buffer, size);
	if (result > 0)
		Seek(result, SEEK_CUR);

	return result;
}
void
VTConsole::SetColor(int32 foreground, int32 background)
{
	static const char cmap[] = {
		15, 4, 2, 6, 1, 5, 3, 7,
		8, 12, 10, 14, 9, 13, 11, 0 };
	char buff[] = "\033b \033c ";

	if (foreground < 0 && foreground >= 16)
		return;
	if (background < 0 && background >= 16)
		return;

	buff[2] += cmap[foreground];
	buff[5] += cmap[background];
	WriteAt(NULL, 0LL, buff, 6);
}
Beispiel #6
0
void
VTConsole::SetColor(int32 foreground, int32 background)
{
	return;
	static const char cmap[] = {
		0, 4, 2, 6, 1, 5, 3, 7 };
	char buffer[12];

	if (foreground < 0 && foreground >= 8)
		return;
	if (background < 0 && background >= 8)
		return;

	// We assume normal display attributes here
	int len = snprintf(buffer, sizeof(buffer),
		"\033[#0;3%" B_PRId32 ";4%" B_PRId32 "m",
		cmap[foreground], cmap[background]);

	WriteAt(NULL, 0LL, buffer, len);
}
Beispiel #7
0
void Player::deRender(double prevX, double prevY)
{
	WriteAt(" ",prevX, prevY, 0, NULL);
}
Beispiel #8
0
void Player::draw()
{
	WriteAt("@", x, y, YELLOW, hConsole);
}
Beispiel #9
0
void
VTConsole::ClearScreen()
{
	WriteAt(NULL, 0LL, "\033[2J", 4);
}
void
VTConsole::ClearScreen()
{
	WriteAt(NULL, 0LL, "\033E", 2);
}
void FileBundleWriter::WriteAtCRC(uint64 write_pos,
                                  void *buffer,
                                  size_t write_len) {
  BufferCRC(buffer, write_len);
  WriteAt(write_pos, buffer, write_len);
}