1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +00:00

Start working on a Widgets library.

This commit is contained in:
Andreas Kling 2018-10-10 15:12:38 +02:00
parent a181a8f6e7
commit 8c84f9749e
18 changed files with 594 additions and 0 deletions

View file

@ -0,0 +1,49 @@
#include "FrameBufferSDL.h"
#include <AK/Assertions.h>
FrameBufferSDL::FrameBufferSDL(unsigned width, unsigned height)
: AbstractScreen(width, height)
{
initializeSDL();
}
FrameBufferSDL::~FrameBufferSDL()
{
SDL_DestroyWindow(m_window);
m_surface = nullptr;
m_window = nullptr;
SDL_Quit();
}
void FrameBufferSDL::show()
{
}
void FrameBufferSDL::initializeSDL()
{
if (m_window)
return;
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
ASSERT_NOT_REACHED();
}
m_window = SDL_CreateWindow(
"FrameBuffer",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
width(),
height(),
SDL_WINDOW_SHOWN);
ASSERT(m_window);
m_surface = SDL_GetWindowSurface(m_window);
ASSERT(m_surface);
SDL_FillRect(m_surface, nullptr, SDL_MapRGB(m_surface->format, 0xff, 0xff, 0xff));
SDL_UpdateWindowSurface(m_window);
}