mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Hololens port
This commit is contained in:
parent
5beac079f6
commit
acde7e04cb
27 changed files with 1501 additions and 0 deletions
83
support/hololens/Servo.cpp
Normal file
83
support/hololens/Servo.cpp
Normal file
|
@ -0,0 +1,83 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "pch.h"
|
||||
#include "Servo.h"
|
||||
|
||||
extern "C" {
|
||||
#include <simpleservo.h>
|
||||
}
|
||||
|
||||
using namespace hlservo;
|
||||
|
||||
void on_load_started() {}
|
||||
void on_load_ended() {}
|
||||
void on_title_changed(const char* title) {}
|
||||
void on_url_changed(const char* url) {}
|
||||
void on_history_changed(bool back, bool fwd) {}
|
||||
void on_shutdown_complete() {}
|
||||
|
||||
std::function<void()> Servo::sFlush = [](){};
|
||||
std::function<void()> Servo::sMakeCurrent = [](){};
|
||||
std::function<void()> Servo::sWakeUp = [](){};
|
||||
bool Servo::sAnimating = false;
|
||||
|
||||
void flush() {
|
||||
Servo::sFlush();
|
||||
}
|
||||
|
||||
void make_current() {
|
||||
Servo::sMakeCurrent();
|
||||
}
|
||||
|
||||
void wakeup() {
|
||||
Servo::sWakeUp();
|
||||
}
|
||||
|
||||
void on_animating_changed(bool aAnimating) {
|
||||
Servo::sAnimating = aAnimating;
|
||||
}
|
||||
|
||||
Servo::Servo(GLsizei width, GLsizei height)
|
||||
: mAnimating(false)
|
||||
, mWindowHeight(height)
|
||||
, mWindowWidth(width) {
|
||||
|
||||
CInitOptions o;
|
||||
o.args = NULL;
|
||||
o.url = "http://example.com";
|
||||
o.width = mWindowWidth;
|
||||
o.height = mWindowHeight;
|
||||
o.density = 1.0;
|
||||
o.enable_subpixel_text_antialiasing = false;
|
||||
|
||||
CHostCallbacks c;
|
||||
c.flush = &flush;
|
||||
c.make_current = &make_current;
|
||||
c.on_load_started = &on_load_started;
|
||||
c.on_load_ended = &on_load_ended;
|
||||
c.on_title_changed = &on_title_changed;
|
||||
c.on_url_changed = &on_url_changed;
|
||||
c.on_history_changed = &on_history_changed;
|
||||
c.on_animating_changed = &on_animating_changed;
|
||||
c.on_shutdown_complete = &on_shutdown_complete;
|
||||
|
||||
init_with_egl(o, &wakeup, c);
|
||||
}
|
||||
|
||||
Servo::~Servo() {
|
||||
deinit();
|
||||
}
|
||||
|
||||
void Servo::PerformUpdates() {
|
||||
perform_updates();
|
||||
}
|
||||
|
||||
void Servo::SetSize(GLsizei width, GLsizei height) {
|
||||
if (width != mWindowWidth || height != mWindowHeight) {
|
||||
mWindowWidth = width;
|
||||
mWindowHeight = height;
|
||||
resize(mWindowWidth, mWindowHeight);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue