Commit 036cb93d authored by Thomas Eppers's avatar Thomas Eppers
Browse files

basic test code for awesomium; this code will be deleted later

parent 9e0fce73
......@@ -4,6 +4,7 @@
#include <asset/asset_manager.hpp>
#include <ecs/entity_manager.hpp>
#include <util/config_manager.hpp>
#include <Awesomium/WebCore.h>
namespace gdw {
class audio;
......@@ -23,6 +24,9 @@ namespace gdw {
// needs to be the last one that will be destroyed
gdw::entity_manager entity_manager_;
Awesomium::WebConfig config_;
Awesomium::WebCore* core_;
Awesomium::WebView* view_;
public:
engine();
......
......@@ -13,10 +13,12 @@
#include <util/config.hpp>
#include <util/logger.hpp>
#include <util/make_unique.hpp>
#include <Awesomium/STLHelpers.h>
#include <Awesomium/BitmapSurface.h>
namespace gdw {
engine::engine()
: quit_(false), config_manager_(*this), entity_manager_(*this) {
: quit_(false), config_manager_(*this), entity_manager_(*this), config_() {
log("game.log");
if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
......@@ -27,6 +29,10 @@ namespace gdw {
audio_ = make_unique<gdw::audio>(*this);
graphics_system_ = make_unique<gdw::graphics_system>(*this);
rendering_system_ = make_unique<gdw::rendering_system>(*this);
core_ = Awesomium::WebCore::Initialize(config_);
view_ = core_->CreateWebView(512, 512);
view_->LoadURL(Awesomium::WebURL(Awesomium::WSLit("http://www.google.com")));
}
engine::~engine() noexcept {
......@@ -37,6 +43,12 @@ namespace gdw {
graphics_system_->begin();
rendering_system_->update(delta_time);
graphics_system_->end(delta_time);
while(view_->IsLoading())
core_->Update();
auto surface = (Awesomium::BitmapSurface*)view_->surface();
if (surface != 0)
surface->SaveToJPEG(Awesomium::WSLit("./result.jpg"));
}
void engine::run() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment