Skip to content

Commit c0a444b

Browse files
committed
Update headers for 1.2.0-beta.2
1 parent 0a5d7f8 commit c0a444b

File tree

15 files changed

+117
-79
lines changed

15 files changed

+117
-79
lines changed

AppCore/JSHelpers.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@
66
#include <functional>
77
#include <memory>
88

9-
///
10-
/// This is a simple C++ wrapper for JavaScriptCore.
11-
///
129
namespace ultralight {
1310

1411
///
1512
/// Set the current JSContext.
1613
///
1714
/// Most JavaScriptCore C API calls require an active JavaScript execution
1815
/// context (JSContextRef). You can get the JSContextRef for a page via
19-
/// `View::js_context()`. This context changes with each page navigation.
16+
/// `View::LockJSContext()`. This context changes with each page navigation.
2017
///
2118
/// **Note**:
2219
/// You MUST set a JSContext before using most of the C++ API below.

JavaScriptCore/JSRetainPtr.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
#include <JavaScriptCore/JSStringRef.h>
3333
#include <algorithm>
3434

35+
#if !defined(WARN_UNUSED_RETURN)
36+
#define WARN_UNUSED_RETURN
37+
#endif
38+
3539
inline void JSRetain(JSStringRef string) { JSStringRetain(string); }
3640
inline void JSRelease(JSStringRef string) { JSStringRelease(string); }
3741
inline void JSRetain(JSGlobalContextRef context) { JSGlobalContextRetain(context); }

Ultralight/Defines.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ UExport uint32_t UltralightVersionPatch();
7878
///
7979
/// Hi there, welcome to the C++ API Reference for Ultralight!
8080
///
81-
/// Ultralight is a fast, lightweight HTML UI engine for desktop apps.
81+
/// Ultralight is a fast, lightweight HTML UI engine for desktop apps and games.
8282
///
8383
/// If this is your first time exploring the API, we recommend
8484
/// starting with ultralight::Renderer and ultralight::View.
8585
///
8686
///
8787
/// @section usefullinks_sec Useful Links
88-
/// - Home: <https://ultralig.ht> -- Get the latest binaries
89-
/// - Docs: <https://docs.ultralig.ht> -- API overview, code snippets, tutorials and more!
90-
/// - Slack: <http://chat.ultralig.ht/> -- Stuck? Have questions? Come chat with us!
91-
/// - GitHub: <https://github.com/ultralight-ux/ultralight> -- Report issues and browse code
88+
/// - Home: <https://ultralig.ht> -- Get the latest binaries
89+
/// - Docs: <https://docs.ultralig.ht> -- API overview, code snippets, tutorials and more!
90+
/// - Discord: <http://chat.ultralig.ht/> -- Stuck? Have questions? Come chat with us!
91+
/// - GitHub: <https://github.com/ultralight-ux/ultralight> -- Report issues and browse code
9292
///
9393
/// @section copyright_sec Copyright
9494
/// Documentation is Copyright (C) 2020 Ultralight, Inc. All rights reserved.

Ultralight/MouseEvent.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ class MouseEvent {
2727
/// The various MouseEvent types.
2828
///
2929
enum Type {
30-
///
30+
///
3131
/// Mouse moved type
32-
///
32+
///
3333
kType_MouseMoved,
3434

35-
///
35+
///
3636
/// Mouse button pressed type
37-
///
37+
///
3838
kType_MouseDown,
3939

40-
///
40+
///
4141
/// Mouse button released type
42-
///
42+
///
4343
kType_MouseUp,
4444
};
4545

Ultralight/RenderTarget.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ namespace ultralight {
2424
/// @brief Rendering details for a View, to be used with your own GPUDriver
2525
///
2626
/// When using your own GPUDriver, each View is rendered to an offscreen
27-
/// texture that you must display on a quad in your engine. This struct
28-
/// provides all the details you need to render the View texture in your
29-
/// engine.
27+
/// texture that you can display on a 3D quad in your application. This struct
28+
/// provides all the details you need to display the corresponding texture in
29+
/// your application.
3030
///
3131
struct UExport RenderTarget {
3232
///

Ultralight/Renderer.h

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@
2020
namespace ultralight {
2121

2222
///
23-
/// @brief The core of Ultralight. You should initialize it after setting up
24-
/// your Platform config and drivers.
25-
///
26-
/// This singleton class manages the lifetime of all Views (@see View) and
27-
/// coordinates all painting, rendering, network requests, and event dispatch.
23+
/// @brief This singleton manages the lifetime of all Views (@see View) and
24+
/// coordinates painting, network requests, and event dispatch.
2825
///
2926
/// @note You don't have to create this instance directly if you use the
3027
/// AppCore API. The App class will automatically create a Renderer and
@@ -39,18 +36,17 @@ class UExport Renderer : public RefCounted {
3936
/// and allows you to manage your own runloop and painting. This method is
4037
/// recommended for those wishing to integrate the library into a game.
4138
///
42-
/// You should set up all your Platform config, file-system, font loader,
43-
/// and drivers before calling this function. (@see <Ultralight/Platform.h>)
39+
/// You should set up your Platform config, file-system, font loader,
40+
/// and surface-factories/gpu-drivers before calling this function.
41+
/// (@see <Ultralight/Platform.h>)
4442
///
4543
/// At a minimum, you will need to define a FontLoader ahead of time or this
4644
/// call will fail. You can use the platform's native FontLoader by calling:
4745
/// <pre>
46+
/// /// This function is defined in <AppCore/Platform.h>
4847
/// Platform::instance().set_font_loader(GetPlatformFontLoader());
4948
/// </pre>
5049
///
51-
/// @note GetPlatformFontLoader() and other native platform handlers are
52-
/// are defined in <AppCore/Platform.h>.
53-
///
5450
/// @note You should only create one Renderer per application lifetime.
5551
///
5652
/// @note: You should not call this if you are using App::Create(), it
@@ -112,13 +108,13 @@ class UExport Renderer : public RefCounted {
112108
virtual void Update() = 0;
113109

114110
///
115-
/// Render all active views to their respective surfaces (or if the GPU
116-
/// renderer is enabled, this will render all views to display lists and
117-
/// dispatch calls to GPUDriver).
111+
/// Render all active views to their respective render-targets/surfaces.
118112
///
119113
/// You should call this once per frame (usually in synchrony with the
120114
/// monitor's refresh rate).
121115
///
116+
/// @note Views are only repainted if they actually need painting.
117+
///
122118
virtual void Render() = 0;
123119

124120
///
@@ -128,7 +124,8 @@ class UExport Renderer : public RefCounted {
128124
virtual void PurgeMemory() = 0;
129125

130126
///
131-
/// Print detailed memory usage statistics to the log. (@see Platform::set_logger())
127+
/// Print detailed memory usage statistics to the log.
128+
/// (@see Platform::set_logger())
132129
///
133130
virtual void LogMemoryUsage() = 0;
134131

Ultralight/Ultralight.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
#pragma once
33
#include <Ultralight/Defines.h>
44
#include <Ultralight/RefPtr.h>
5-
#include <Ultralight/String16.h>
65
#include <Ultralight/String8.h>
6+
#include <Ultralight/String16.h>
7+
#include <Ultralight/String32.h>
78
#include <Ultralight/String.h>
89
#include <Ultralight/Bitmap.h>
910
#include <Ultralight/Buffer.h>
1011
#include <Ultralight/View.h>
12+
#include <Ultralight/Session.h>
1113
#include <Ultralight/KeyCodes.h>
1214
#include <Ultralight/KeyEvent.h>
1315
#include <Ultralight/Listener.h>
@@ -22,3 +24,6 @@
2224
#include <Ultralight/platform/GPUDriver.h>
2325
#include <Ultralight/platform/FileSystem.h>
2426
#include <Ultralight/platform/FontLoader.h>
27+
#include <Ultralight/platform/Surface.h>
28+
#include <Ultralight/platform/Clipboard.h>
29+
#include <Ultralight/platform/Logger.h>

Ultralight/View.h

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,25 @@
2626
namespace ultralight {
2727

2828
///
29-
/// @brief A View is similar to a tab in a browser-- you load web content into
30-
/// it and display it however you want. @see Renderer::CreateView
29+
/// @brief The View class is used to load and display web content.
3130
///
32-
/// @note The API is currently not thread-safe, all calls must be made on the
33-
/// main thread.
31+
/// View is an offscreen web-page container that can be used to display
32+
/// web-content in your application.
33+
///
34+
/// You can load content into a View via View::LoadURL() or View::LoadHTML()
35+
/// and interact with it via View::FireMouseEvent() and similar API.
36+
///
37+
/// When displaying a View, the API is different depending on whether you
38+
/// are using the CPU renderer or the GPU renderer:
39+
///
40+
/// When using the CPU renderer, you would get the underlying pixel-buffer
41+
/// surface for a View via View::surface().
42+
///
43+
/// When using the GPU renderer, you would get the underlying render target
44+
/// and texture information via View::render_target().
45+
///
46+
/// @note The API is not currently thread-safe, all calls must be made on the
47+
/// same thread that the Renderer/App was created on.
3448
///
3549
class UExport View : public RefCounted {
3650
public:
@@ -60,7 +74,7 @@ class UExport View : public RefCounted {
6074
virtual bool is_loading() = 0;
6175

6276
///
63-
/// Get the RenderTarget for the View.
77+
/// Get the offscreen RenderTarget for the View.
6478
///
6579
/// @note Only valid when the GPU renderer is enabled in Config.
6680
///
@@ -70,11 +84,10 @@ class UExport View : public RefCounted {
7084
virtual RenderTarget render_target() = 0;
7185

7286
///
73-
/// Get the Surface for the View (native pixel buffer container).
74-
///
75-
/// @note Only valid when the GPU renderer is disabled in Config.
87+
/// Get the offscreen Surface for the View (pixel-buffer container).
7688
///
77-
/// (Will return a nullptr when the GPU renderer is enabled.)
89+
/// @note Only valid when the CPU is enabled (will return a nullptr
90+
/// otherwise)
7891
///
7992
/// The default Surface is BitmapSurface but you can provide your
8093
/// own Surface implementation via Platform::set_surface_factory.

Ultralight/platform/Clipboard.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ namespace ultralight {
2222
///
2323
/// This is used for reading and writing data to the platform Clipboard.
2424
///
25-
/// This is intended to be implemented by users and defined before creating the
26-
/// Renderer. @see Platform::set_clipboard.
25+
/// AppCore automatically provides a platform-specific implementation of this
26+
/// that cuts/copies/pastes to the OS clipboard when you call App::Create().
27+
///
28+
/// If you are using Renderer::Create() instead, you will need to provide your
29+
/// own implementation of this. @see Platform::set_clipboard().
2730
///
2831
class UExport Clipboard {
2932
public:

Ultralight/platform/Config.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
namespace ultralight {
1919

2020
///
21-
/// The winding order for front-facing triangles.
21+
/// The winding order for front-facing triangles. (This is only used when the
22+
/// GPU renderer is enabled)
2223
///
2324
/// @note In most 3D engines, there is the concept that triangles have a
2425
/// a "front" and a "back". All the front-facing triangles (eg, those

0 commit comments

Comments
 (0)