summaryrefslogblamecommitdiff
path: root/Source/Kernel/DeviceManager/Disp.ns.cpp
blob: 28278699f0a144598d2847b02be892749a7c1f32 (plain) (tree)
1
2
3
4
5
6
7
8
                    
                                 
                            



                
                     








                             
                                                             








                                                                  



                                                                                    



                             








                                                            

                                 

                                               
                                   









                                


 
#include "Disp.ns.h"
#include <DeviceManager/Dev.ns.h>
#include <VTManager/VT.ns.h>

namespace Disp {

mode_t mode;
Vector<mode_t> modes;

u16int textCols() {
	return mode.textCols;
}

u16int textRows() {
	return mode.textRows;
}

void putChar(u16int line, u16int col, WChar c, u8int color) {
	if (line >= mode.textRows or col >= mode.textCols) return;
	mode.device->putChar(line, col, c, color);
}

void moveCursor(u16int line, u16int col) {
	if (line >= mode.textRows or col >= mode.textCols) return;
	mode.device->moveCursor(line, col);
}

bool textScroll(u16int line, u16int col, u16int height, u16int width, u8int color) {
	return mode.device->textScroll(line, col, height, width, color);
}

void clear() {
	mode.device->clear();
}

void getModes() {
	modes.clear();
	Vector<Device*> disps = Dev::findDevices("display");
	for (u32int i = 0; i < disps.size(); i++) {
		((Display*)(disps[i]))->getModes(modes);
	}
}

bool setMode(mode_t& newmode) {
	mode.device->unsetMode();

	if (newmode.device->setMode(newmode)) {
		mode = newmode;
		VT::redrawScreen();
		return true;
	}
	return false;
}

void setText(VGATextOutput* o) {
	mode.device = o;
	o->clear();
	mode.textCols = 80;
	mode.textRows = 25;
}

}