This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "gl_texture_surface.h" | |
#include <iostream> | |
GLRAMTextureSurface::GLRAMTextureSurface(int width, int height) : texture_id_(0), | |
buffer_(0), bpp_(4), rowspan_(0), width_(width), height_(height) { | |
rowspan_ = width_ * bpp_; | |
buffer_ = new unsigned char[rowspan_ * height_]; | |
needs_update_ = false; | |
glGenTextures(1, &texture_id_); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void handleTextInputEvent(const SDL_Event& event) { | |
Awesomium::WebKeyboardEvent keyEvent; | |
keyEvent.type = Awesomium::WebKeyboardEvent::kTypeChar; | |
// WebKit's WebKeyboardEvent only supports up to 4 chars per "text" event | |
// but SDL supports up to 32 chars. If we really wanted to do this right, | |
// we'd probably need to inject several events for text > 4 chars. | |
// Let's just trim it down to 4 for now. | |
for (int i = 0; i < 4; i++) { | |
keyEvent.text[i] = (wchar16)event.text.text[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "gl_texture_surface.h" | |
#include <iostream> | |
#include <cstring> | |
#include <cstdlib> | |
GLRAMTextureSurface::GLRAMTextureSurface(int width, int height) : texture_id_(0), | |
buffer_(0), bpp_(4), rowspan_(0), width_(width), height_(height) { | |
rowspan_ = width_ * bpp_; | |
buffer_ = new unsigned char[rowspan_ * height_]; | |
needs_update_ = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "gl_texture_surface.h" | |
#include <iostream> | |
#include <cstring> | |
#include <cstdlib> | |
GLRAMTextureSurface::GLRAMTextureSurface(int width, int height) : texture_id_(0), | |
buffer_(0), bpp_(4), rowspan_(0), width_(width), height_(height) { | |
rowspan_ = width_ * bpp_; | |
buffer_ = new unsigned char[rowspan_ * height_]; | |
needs_update_ = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef ULTRALIGHT_CAPI_H | |
#define ULTRALIGHT_CAPI_H | |
#ifndef __cplusplus | |
#include <stdbool.h> | |
#endif | |
#include <stddef.h> | |
#include <uchar.h> | |
#include <JavaScriptCore/JavaScript.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inside Tab.cpp, replace your void Tab::OnAddConsoleMessage definition with all of the following: | |
inline std::string ToUTF8(const String& str) { | |
String8 utf8 = str.utf8(); | |
return std::string(utf8.data(), utf8.length()); | |
} | |
inline const char* Stringify(MessageSource source) { | |
switch(source) { | |
case kMessageSource_XML: return "XML"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <AppCore/App.h> | |
#include <AppCore/Window.h> | |
#include <AppCore/Overlay.h> | |
#include <AppCore/JSHelpers.h> | |
using namespace ultralight; | |
const char* htmlString(); | |
class MyApp : public LoadListener { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- This is an example of using themeable JavaScript replacements to style | |
<select> elements in Ultralight. | |
--> | |
<html> | |
<head> | |
<link href="https://unpkg.com/mobius1-selectr@latest/dist/selectr.min.css" | |
rel="stylesheet" type="text/css"> | |
<script src="https://unpkg.com/mobius1-selectr@latest/dist/selectr.min.js" | |
type="text/javascript"></script> | |
<style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "MyApp.h" | |
#include <chrono> | |
#include <thread> | |
#define WINDOW_WIDTH 600 | |
#define WINDOW_HEIGHT 400 | |
const char* htmlString(); | |
MyApp::MyApp() { |
OlderNewer