diff options
Diffstat (limited to 'Source/Kernel/DeviceManager')
-rw-r--r-- | Source/Kernel/DeviceManager/Disp.ns.cpp | 28 | ||||
-rw-r--r-- | Source/Kernel/DeviceManager/Disp.ns.h | 13 |
2 files changed, 34 insertions, 7 deletions
diff --git a/Source/Kernel/DeviceManager/Disp.ns.cpp b/Source/Kernel/DeviceManager/Disp.ns.cpp index 4be8d03..246e959 100644 --- a/Source/Kernel/DeviceManager/Disp.ns.cpp +++ b/Source/Kernel/DeviceManager/Disp.ns.cpp @@ -1,8 +1,10 @@ #include "Disp.ns.h" +#include <DeviceManager/Dev.ns.h> namespace Disp { mode_t mode; +Vector<mode_t> modes; u16int textCols() { return mode.textCols; @@ -26,11 +28,27 @@ void clear() { mode.device->clear(); } -void setDisplay(Display* disp) { - mode.device = disp; - disp->clear(); - mode.textCols = disp->textCols(); - mode.textRows = disp->textRows(); +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) { + if (newmode.device->setMode(newmode)) { + mode = newmode; + return true; + } + return false; +} + +void setText(VGATextOutput* o) { + mode.device = o; + o->clear(); + mode.textCols = 80; + mode.textRows = 25; } } diff --git a/Source/Kernel/DeviceManager/Disp.ns.h b/Source/Kernel/DeviceManager/Disp.ns.h index 0eea51d..0d56cf0 100644 --- a/Source/Kernel/DeviceManager/Disp.ns.h +++ b/Source/Kernel/DeviceManager/Disp.ns.h @@ -1,22 +1,31 @@ #ifndef DEF_DISP_NS_H #define DEF_DISP_NS_H -#include <Devices/Display/Display.proto.h> +#include <Devices/Display/VGATextOutput.class.h> #include <WChar.class.h> +#include <Vector.class.h> namespace Disp { struct mode_t { int textCols, textRows; + int graphWidth, graphHeight, graphDepth; + int identifier; //Used by video devices Display *device; }; + extern Vector<mode_t> modes; + extern mode_t mode; + u16int textCols(); u16int textRows(); void putChar(u16int line, u16int col, WChar c, u8int color); void moveCursor(u16int line, u16int col); void clear(); - void setDisplay(Display* disp); + void getModes(); + bool setMode(mode_t& mode); + + void setText(VGATextOutput* o); //To use only once : when display is initializing } #endif |