Compare commits
No commits in common. "f0651ef97252233f1fc40e2908a3af7f2bf3433a" and "006c9022001509f2e4ec647252259e8cb857a76a" have entirely different histories.
f0651ef972
...
006c902200
10
Makefile
10
Makefile
@ -5,7 +5,7 @@ CC = ${HOME}/opt/cross/bin/i686-elf-gcc
|
|||||||
CPP = ${HOME}/opt/cross/bin/i686-elf-g++
|
CPP = ${HOME}/opt/cross/bin/i686-elf-g++
|
||||||
CFLAGS = -ffreestanding -O2 -Wall -Wextra
|
CFLAGS = -ffreestanding -O2 -Wall -Wextra
|
||||||
|
|
||||||
OFILES = $(BUILD_DIR)/boot.o $(BUILD_DIR)/window.o $(BUILD_DIR)/cursor.o $(BUILD_DIR)/kterm.o $(BUILD_DIR)/kernel.o $(BUILD_DIR)/PhysicalMemoryManager.o $(BUILD_DIR)/io.o $(BUILD_DIR)/vesa.o $(BUILD_DIR)/PageDirectory.o $(BUILD_DIR)/gdtc.o $(BUILD_DIR)/idt.o $(BUILD_DIR)/pic.o $(BUILD_DIR)/string.o
|
OFILES = $(BUILD_DIR)/boot.o $(BUILD_DIR)/kterm.o $(BUILD_DIR)/kernel.o $(BUILD_DIR)/PhysicalMemoryManager.o $(BUILD_DIR)/io.o $(BUILD_DIR)/vesa.o $(BUILD_DIR)/PageDirectory.o $(BUILD_DIR)/gdtc.o $(BUILD_DIR)/idt.o $(BUILD_DIR)/pic.o $(BUILD_DIR)/string.o
|
||||||
|
|
||||||
SRC_DIR = src
|
SRC_DIR = src
|
||||||
BUILD_DIR = build
|
BUILD_DIR = build
|
||||||
@ -89,10 +89,4 @@ $(BUILD_DIR)/PhysicalMemoryManager.o:
|
|||||||
$(CPP) -c $(SRC_DIR)/kernel/memory/PhysicalMemoryManager.cpp -o $(BUILD_DIR)/PhysicalMemoryManager.o $(CFLAGS) -fno-exceptions -fno-rtti
|
$(CPP) -c $(SRC_DIR)/kernel/memory/PhysicalMemoryManager.cpp -o $(BUILD_DIR)/PhysicalMemoryManager.o $(CFLAGS) -fno-exceptions -fno-rtti
|
||||||
|
|
||||||
$(BUILD_DIR)/vesa.o:
|
$(BUILD_DIR)/vesa.o:
|
||||||
$(CPP) -c $(SRC_DIR)/kernel/drivers/vesa/vesa.cpp -o $(BUILD_DIR)/vesa.o $(CFLAGS) -fno-exceptions -fno-rtti
|
$(CPP) -c $(SRC_DIR)/kernel/vesa.cpp -o $(BUILD_DIR)/vesa.o $(CFLAGS) -fno-exceptions -fno-rtti
|
||||||
|
|
||||||
$(BUILD_DIR)/window.o:
|
|
||||||
$(CPP) -c $(SRC_DIR)/gui/window.cpp -o $(BUILD_DIR)/window.o $(CFLAGS) -fno-exceptions -fno-rtti
|
|
||||||
|
|
||||||
$(BUILD_DIR)/cursor.o:
|
|
||||||
$(CPP) -c $(SRC_DIR)/gui/cursor.cpp -o $(BUILD_DIR)/cursor.o $(CFLAGS) -fno-exceptions -fno-rtti
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
class Graphics {
|
|
||||||
|
|
||||||
};
|
|
@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
|
|
||||||
class Widget{
|
|
||||||
virtual void draw();
|
|
||||||
|
|
||||||
};
|
|
@ -1,17 +0,0 @@
|
|||||||
#include "cursor.h"
|
|
||||||
|
|
||||||
void Cursor::draw(){
|
|
||||||
for(int i = 0; i < this->width; i++){
|
|
||||||
for(int j = 0; j < this->height; j++){
|
|
||||||
if(this->bitmap[j * this->width + i] == 1 ){
|
|
||||||
putPixel(i + this->x,j + this->y, 0xFF000000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Cursor::Cursor(int x, int y){
|
|
||||||
this->x = x;
|
|
||||||
this->y = y;
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "../kernel/drivers/vesa/vesa.h"
|
|
||||||
|
|
||||||
|
|
||||||
class Cursor{
|
|
||||||
public:
|
|
||||||
void draw();
|
|
||||||
Cursor(int x, int y);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
const int width= 16;
|
|
||||||
const int height= 10;
|
|
||||||
const int bitmap [160] = {
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
|
|
||||||
0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,
|
|
||||||
|
|
||||||
0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,
|
|
||||||
|
|
||||||
0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,
|
|
||||||
|
|
||||||
0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,
|
|
||||||
|
|
||||||
0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,
|
|
||||||
|
|
||||||
0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,
|
|
||||||
|
|
||||||
0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,
|
|
||||||
|
|
||||||
0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,
|
|
||||||
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
};
|
|
||||||
};
|
|
@ -1,33 +0,0 @@
|
|||||||
#include "window.h"
|
|
||||||
|
|
||||||
int Window::getWidth(){
|
|
||||||
return this->rect.width;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Window::getHeight(){
|
|
||||||
return this->rect.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::setWidth(int& width){
|
|
||||||
this->rect.width = width;
|
|
||||||
}
|
|
||||||
void Window::setHeight(int& height){
|
|
||||||
this->rect.height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Window::getX(){
|
|
||||||
return this->rect.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Window::getY(){
|
|
||||||
return this->rect.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
Window::Window (Rect& rect , uint32_t colour){
|
|
||||||
this->rect = rect;
|
|
||||||
this->Background_colour = colour;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::draw(){
|
|
||||||
drawRect(this->getX() , this->getY() , this->getWidth() , this->getHeight() ,this->Background_colour );
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "../kernel/drivers/vesa/vesa.h"
|
|
||||||
#include "Widget.h"
|
|
||||||
|
|
||||||
struct Rect {
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Window : Widget{
|
|
||||||
|
|
||||||
public:
|
|
||||||
int getX();
|
|
||||||
int getY();
|
|
||||||
|
|
||||||
int getWidth();
|
|
||||||
int getHeight();
|
|
||||||
void setWidth(int&);
|
|
||||||
void setHeight(int&);
|
|
||||||
|
|
||||||
Window (Rect& rect , uint32_t colour);
|
|
||||||
void draw();
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
Rect rect;
|
|
||||||
uint32_t Background_colour;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
@ -1,10 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "bootloader/multiboot.h"
|
#include "bootloader/multiboot.h"
|
||||||
#define CHECK_FLAG(flags, bit) ((flags) & (1 <<(bit)))
|
#define CHECK_FLAG(flags, bit) ((flags) & (1 <<(bit)))
|
||||||
#include "../gui/window.h"
|
|
||||||
#include "../gui/cursor.h"
|
|
||||||
#include "tty/kterm.h"
|
#include "tty/kterm.h"
|
||||||
#include "drivers/vesa/vesa.h"
|
#include "vesa.h"
|
||||||
|
|
||||||
void CheckMBT ( multiboot_info_t* mbt ){
|
void CheckMBT ( multiboot_info_t* mbt ){
|
||||||
/* Set MBI to the addresss of the multiboot information structure*/
|
/* Set MBI to the addresss of the multiboot information structure*/
|
||||||
@ -76,32 +75,11 @@ void CheckMBT ( multiboot_info_t* mbt ){
|
|||||||
// Init vesa driver
|
// Init vesa driver
|
||||||
initVBEDevice(mbt);
|
initVBEDevice(mbt);
|
||||||
|
|
||||||
// Fill screen with blue
|
// Turn pixel on in the middle of the screen;
|
||||||
// colours AARRGGBB
|
putPixel( 50, 50 , 0x00FFFFFF);
|
||||||
drawRect(0, 0 , VbeModeInfo->width,VbeModeInfo->height, 0xFF0000FF);
|
|
||||||
|
|
||||||
// Create two windows
|
putPixel(VbeModeInfo->width / 2 , VbeModeInfo->height / 2 , 0x00FF0000);
|
||||||
Rect rect_window1 {};
|
drawLine(50,10, 150, 8, 0x00FF00FF);
|
||||||
Rect rect_window2 {};
|
|
||||||
rect_window1.height =200;
|
|
||||||
rect_window1.width = 300;
|
|
||||||
rect_window1.x = 50;
|
|
||||||
rect_window1.y = 50;
|
|
||||||
|
|
||||||
rect_window2.height =200;
|
|
||||||
rect_window2.width = 300;
|
|
||||||
rect_window2.x = 300;
|
|
||||||
rect_window2.y = 200;
|
|
||||||
|
|
||||||
Window window_1 ( rect_window1, 0xFF00F0FF);
|
|
||||||
Window window_2 (rect_window2, 0xFFAACCDD);
|
|
||||||
|
|
||||||
window_1.draw();
|
|
||||||
window_2.draw();
|
|
||||||
|
|
||||||
Cursor cursor (70,100);
|
|
||||||
|
|
||||||
cursor.draw();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,13 @@ void initVBEDevice(multiboot_info_t* mbt){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void putPixel( int x, int y , uint32_t colour){
|
void putPixel( int x, int y , uint32_t colour){
|
||||||
// printf_serial("putPixel x: %d, y: %d\n", x, y);
|
printf_serial("putPixel x: %d, y: %d\n", x, y);
|
||||||
///fb + mbt->framebuffer_pitch * y + 4 * x ,NOTE: this calculation is very important
|
///fb + mbt->framebuffer_pitch * y + 4 * x ,NOTE: this calculation is very important
|
||||||
*(uint32_t*) ( VbeModeInfo->framebuffer + VbeModeInfo->pitch * y + 4 * x ) = colour;
|
*(uint32_t*) ( VbeModeInfo->framebuffer + VbeModeInfo->pitch * y + 4 * x ) = colour;
|
||||||
}
|
}
|
||||||
void drawLine(int x1, int y1, int x2, int y2, uint32_t colour ){
|
void drawLine(int x1, int y1, int x2, int y2, uint32_t colour ){
|
||||||
print_serial("drawline\n");
|
print_serial("drawline\n");
|
||||||
// See Bresenham's line algorithm
|
// Bresenham's line algorithm??
|
||||||
int deltaX = x2 - x1;
|
int deltaX = x2 - x1;
|
||||||
int deltaY = y2 - y1;
|
int deltaY = y2 - y1;
|
||||||
int D = 2 * deltaY - deltaX;
|
int D = 2 * deltaY - deltaX;
|
||||||
@ -41,14 +41,6 @@ void drawLine(int x1, int y1, int x2, int y2, uint32_t colour ){
|
|||||||
}
|
}
|
||||||
void drawRect ( int x, int y, int width, int height, uint32_t colour ){
|
void drawRect ( int x, int y, int width, int height, uint32_t colour ){
|
||||||
print_serial("drawRect\n");
|
print_serial("drawRect\n");
|
||||||
for ( int i = x; i < x + width; i ++)
|
|
||||||
{
|
|
||||||
for(int j = y; j < y + height; j++){
|
|
||||||
|
|
||||||
putPixel(i,j, colour);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "../../bootloader/multiboot.h"
|
#include "bootloader/multiboot.h"
|
||||||
#include "../../serial.h"
|
#include "serial.h"
|
||||||
|
|
||||||
struct vbe_mode_info_structure{
|
struct vbe_mode_info_structure{
|
||||||
uint16_t attributes;
|
uint16_t attributes;
|
Loading…
x
Reference in New Issue
Block a user