console.h

来自「Jazmyn is a 32-bit, protected mode, mult」· C头文件 代码 · 共 98 行

H
98
字号
#ifndef _CONSOLE_H
#define _CONSOLE_H

class process;

#include "driver.h"
#include "drvreq.h"


#define WHITE   0x0700
#define cout   _console_obj
#define endl	'\n'
class console: public driver
{
private:
	int	row;
	int	col;
	ushort	*base;
        ushort  attr;
public:
	console		(char* name);
	~console	();
	console&	operator<<(char* _s);
	console&	operator<<(uchar _c);
	console&	operator<<(uint _i);
	void		scroll();
	void		update_cursor();

	inline console& operator<<(char _c)
	{
		return *this<<(uchar)_c;
	}

	inline console& operator<<(int _i)
	{
		if(_i < 0 ) {*this<<'-';_i = -_i;}
		return *this<<(uint)_i;
	}

	inline console& operator<<(ushort _i)
	{
		return *this<<(uint)_i;
	}

	inline console& operator<<(short _i)
	{
                if(_i < 0 ) {*this<<'-';_i = -_i;}
		return *this<<(uint)_i;
	}

	inline console& operator<<(ulong _i)
	{
		return *this<<(uint)_i;
	}

	inline console& operator<<(long _i)
	{
		if(_i < 0) {*this<<'-';_i = -_i;}
		return *this<<(uint)_i;
	}

	inline void clrscr()
	{
                memset_w(base,(' '|attr),80*25);
		row = col = 0;
		update_cursor();
	}

	inline void gotoxy(int x,int y)
	{
		col = x;
		row = y * 80;
		update_cursor();
	}

	inline console& operator<<(float _f)
	{
		return *this;
	}
	
	inline console& operator<<(double _d)
	{
		return *this;
	}

	inline console& operator<<(ldouble _d)
	{
		return *this;
	}
        void dispnum(uint num,int base);
};

int     console_main(void *arg);

extern console _console_obj;

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?