Start working on new architecture

This commit is contained in:
Joshua Granick
2014-06-06 14:44:13 -07:00
parent a6157c0b78
commit 4818c02b1e
76 changed files with 961 additions and 11050 deletions

View File

@@ -0,0 +1,66 @@
#include "SDLApplication.h"
namespace lime {
SDLApplication::SDLApplication () {
SDL_Init (SDL_INIT_VIDEO);
}
SDLApplication::~SDLApplication () {
}
int SDLApplication::Exec () {
SDL_Event event;
bool active = true;
while (active) {
while (active && SDL_WaitEvent (&event)) {
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE) {
active = false;
break;
}
}
while (active && SDL_PollEvent (&event)) {
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE) {
active = false;
break;
}
}
}
SDL_Quit ();
return 0;
}
Application* CreateApplication () {
return new SDLApplication ();
}
}

View File

@@ -0,0 +1,27 @@
#ifndef LIME_SDL_APPLICATION_H
#define LIME_SDL_APPLICATION_H
#include <SDL.h>
#include "Application.h"
namespace lime {
class SDLApplication : public Application {
public:
SDLApplication ();
~SDLApplication ();
virtual int Exec ();
};
}
#endif

View File

@@ -0,0 +1,30 @@
#include "SDLWindow.h"
#include "SDLRenderer.h"
namespace lime {
SDLRenderer::SDLRenderer (Window* window) {
currentWindow = window;
sdlRenderer = SDL_CreateRenderer (((SDLWindow*)window)->sdlWindow, -1, 0);
}
SDLRenderer::~SDLRenderer () {
}
Renderer* CreateRenderer (Window* window) {
return new SDLRenderer (window);
}
}

View File

@@ -0,0 +1,27 @@
#ifndef LIME_SDL_RENDERER_H
#define LIME_SDL_RENDERER_H
#include <SDL.h>
#include "Renderer.h"
namespace lime {
class SDLRenderer : public Renderer {
public:
SDLRenderer (Window* window);
~SDLRenderer ();
SDL_Renderer* sdlRenderer;
};
}
#endif

View File

@@ -0,0 +1,30 @@
#include "SDLWindow.h"
#include <stdio.h>
namespace lime {
SDLWindow::SDLWindow (Application* application) {
currentApplication = application;
sdlWindow = SDL_CreateWindow ("Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, 0);
}
SDLWindow::~SDLWindow () {
}
Window* CreateWindow (Application* application) {
return new SDLWindow (application);
}
}

View File

@@ -0,0 +1,27 @@
#ifndef LIME_SDL_WINDOW_H
#define LIME_SDL_WINDOW_H
#include <SDL.h>
#include "Window.h"
namespace lime {
class SDLWindow : public Window {
public:
SDLWindow (Application* application);
~SDLWindow ();
SDL_Window* sdlWindow;
};
}
#endif