Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
182d4bc
[imageloader] libpng implement CreateImageFromMemory
Moros1138 Feb 27, 2026
bb59433
[imageloader] remove comments and update header
Moros1138 Feb 27, 2026
619a0b6
[imageloader] wingdi implement CreateImageFromMemory
Moros1138 Feb 27, 2026
3a23c54
[sh] update single header
Moros1138 Feb 27, 2026
9c74dad
[examples] add temporary example with CreateImageFromMemory
Moros1138 Feb 27, 2026
636c1de
[imageloader][MacOS] use CoreGraphics/ImageIO for graphics loading, i…
Moros1138 Feb 28, 2026
e5fd066
[imageloader][MacOS] CoreGraphics/ImageIO premultiplies, we want raw …
Moros1138 Feb 28, 2026
33ab50e
[imageloader][MacOS] add imageloader_pixel_t for easier pixel swizzling.
Moros1138 Feb 28, 2026
f635038
[imageloader][MacOS] remove un-premultiply from image loader
Moros1138 Feb 28, 2026
ef1bb0e
[imageloader][MacOS] use CGDataProvider instead of the CGBitmapContext
Moros1138 Feb 28, 2026
b657b87
[sh] update single header
Moros1138 Feb 28, 2026
c11f25c
[emscripten] add SetFullscreen to host
Moros1138 Mar 3, 2026
d5a6dce
fix android host
DCubix Mar 4, 2026
aefca17
[core] should say OnBeforeSystemUpdate instead of OnAfterUserCreate
Moros1138 Mar 6, 2026
aa8ac2f
[sh] update single header
Moros1138 Mar 6, 2026
d0aedbf
225-some-gpus-are-having-issues-with-wgl_swap_buffer-intel-irishduhd-…
Johnnyg63 Mar 7, 2026
20e7716
Windows OS Window Furniture completed, SH updated.
Johnnyg63 Mar 7, 2026
a8e8f2e
Add support for libdecor to unbreak mutter and similarly bad composit…
dandistine Mar 7, 2026
e386490
Change cursor shape protocol for wayland-cursor
dandistine Mar 8, 2026
379523f
Merge pull request #223 from OneLoneCoder/fix-misleading-message
OneLoneCoder Mar 8, 2026
c6035c5
228-correct-return-false-from-onuserupdate-causing-cross-threading
Johnnyg63 Mar 8, 2026
08db92d
Init some nullptrs
dandistine Mar 8, 2026
c8bc9b0
Add MacOS Windows Furniture and removed two debug lines from host_win…
Johnnyg63 Mar 8, 2026
7aeeea7
Merge branch 'develop' into 219-fix-android-host
DCubix Mar 8, 2026
e881999
add olc_OnFocus
DCubix Mar 8, 2026
4e6bd02
Fix libdecor threading and a bunch of unreleased pointers
dandistine Mar 10, 2026
6a8f614
Merge pull request #217 from OneLoneCoder/emscripten-set-fullscreen
OneLoneCoder Mar 15, 2026
06be35f
Merge pull request #210 from OneLoneCoder/imageloader-implement-loadi…
OneLoneCoder Mar 15, 2026
cc2b997
Merge pull request #220 from OneLoneCoder/219-fix-android-host
OneLoneCoder Mar 15, 2026
3a27e94
Merge pull request #227 from dandistine/wayland_lib_decor
OneLoneCoder Mar 15, 2026
147fea0
Merge pull request #226 from OneLoneCoder/225-some-gpus-are-having-is…
OneLoneCoder Mar 15, 2026
ee22250
Merge pull request #229 from OneLoneCoder/228-correct-return-false-fr…
OneLoneCoder Mar 15, 2026
6a6d2ef
Add window config struct
dandistine Mar 15, 2026
f86cf1d
Finish making certain configs per-window.
dandistine Mar 15, 2026
8b34d6f
Reset the default multiwindow mode
dandistine Mar 15, 2026
544bf15
Begin wayland implementation
dandistine Mar 15, 2026
dedb361
Finish wayland
dandistine Mar 15, 2026
f9370a4
Now do X11
dandistine Mar 15, 2026
8a8b633
Merge branch 'develop' into 42-window-furniture-options-07-03-2026
Johnnyg63 Mar 16, 2026
c435a18
On MacOS, the maximize button is tied to the resizable style,…
Johnnyg63 Mar 16, 2026
6e1eb21
On MacOS, the maximize button is tied to the resizable style,…
Johnnyg63 Mar 18, 2026
d09d107
Updated PGE SH
Johnnyg63 Mar 18, 2026
7be29ea
RAII and clean exit failing on MacOS
Johnnyg63 Mar 19, 2026
728ffb5
Merge pull request #235 from OneLoneCoder/234-raii-and-clean-exit-fai…
OneLoneCoder Mar 22, 2026
05a966a
Merge pull request #232 from dandistine/add_window_configs
OneLoneCoder Mar 22, 2026
09862b5
Merge branch 'develop' into 42-window-furniture-options-07-03-2026
Johnnyg63 Mar 22, 2026
b2d337b
Merge pull request #230 from OneLoneCoder/42-window-furniture-options…
OneLoneCoder Mar 22, 2026
7383742
Merge pull request #233 from dandistine/window_configs_for_linux
OneLoneCoder Mar 22, 2026
4b1009a
oops lol
OneLoneCoder Mar 22, 2026
b3ed744
Merge pull request #236 from OneLoneCoder/windows-alt-key
OneLoneCoder Mar 22, 2026
94b20e4
+Draw::ImageRect(batch)
OneLoneCoder Apr 3, 2026
d75fc38
+FilledPolygon(batch, col)
OneLoneCoder Apr 3, 2026
23bde5b
+TextureBatch type
OneLoneCoder Apr 3, 2026
710847c
+Draw2D::TexturedTriangle(batch)
OneLoneCoder Apr 3, 2026
cd70886
+sh sync
OneLoneCoder Apr 3, 2026
dce5543
Merge pull request #243 from OneLoneCoder/96-draw-image-batch-routines
OneLoneCoder Apr 3, 2026
18c9c01
Beta A - Release
OneLoneCoder Apr 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dev/msvc/olcPGE3_BuildSH/olcPGE3_BuildSH.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<ClCompile Include="..\..\..\examples\olcPGE3_CirclesEllipses.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\examples\olcPGE3_Extensions.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
Expand All @@ -58,8 +58,8 @@
<ClCompile Include="..\..\..\examples\olcPGE3_Fish.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\examples\olcPGE3_ImageRegion.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
Expand Down
275 changes: 141 additions & 134 deletions dev/src/api_macos.cpp

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion dev/src/api_macos.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <OpenGL/gl.h>
#include <OpenGL/OpenGL.h>
#include <CoreGraphics/CoreGraphics.h>
#include <ImageIO/ImageIO.h>

extern "C" {
// NSRect (OSX rectangle structure same as GCRect C structure)
Expand Down Expand Up @@ -56,7 +57,7 @@ extern "C" {

// Window API - as implemented in api_macos.c
struct Window* window_init (double x, double y, double width, double height);
void window_create (struct Window* self);
void window_create (struct Window* self, unsigned long styleMask);
void window_show (struct Window* self);
void window_destroy (struct Window* self);
void window_setTitle (struct Window* self, const char* title);
Expand All @@ -72,6 +73,8 @@ extern "C" {
void window_setContentViewFrame (struct Window* self, double* x, double* y, double* width, double* height);
void window_setCursorVisibility (struct Window* self, BOOL visible);
void window_setCursorPosition (struct Window* self, double x, double y);
void window_toggleFullScreen (struct Window* self);
bool window_isFullScreen (struct Window* self);

// OpenGL Renderer API - as implemented in api_macos.c
struct OpenGLRenderer* opengl_init (void);
Expand All @@ -85,9 +88,15 @@ extern "C" {
void opengl_destroy (struct OpenGLRenderer* self);
bool opengl_resetContextForSize (struct OpenGLRenderer* self, double width, double height);

// Pixel Struct used by Image Loader API
typedef struct {
uint8_t r; uint8_t g; uint8_t b; uint8_t a;
} imageloader_pixel_t;

// Image Loader API - as implemented in api_macos.c
struct ImageLoader* imageloader_init (void);
BOOL imageloader_loadFromFile (struct ImageLoader* self, const char* filePath);
BOOL imageloader_loadFromMemory (struct ImageLoader* self, const uint8_t* data, size_t bytes);
void imageloader_destroy (struct ImageLoader* self);
unsigned char* imageloader_getPixelData (const struct ImageLoader* self);
void imageloader_getImageInfo (const struct ImageLoader* self, int* width, int* height, int* bytesPerPixel);
Expand Down
34 changes: 27 additions & 7 deletions dev/src/api_macos_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ namespace olc {
~Application() {
if (app_) {
application_destroy(app_); // application_destroy now handles delete internally
app_ = nullptr;
}
}

Expand All @@ -96,10 +97,9 @@ namespace olc {
if (app_) application_run(app_);
}

void terminate() noexcept {
void stop() noexcept {
if (app_) {
application_stop(app_);
app_ = nullptr;
}
}

Expand Down Expand Up @@ -220,10 +220,10 @@ namespace olc {
struct ::Window* getCHandle() const noexcept { return window_; }

// Create and show the window
void show() {
void show(unsigned long styleMask) {
if (window_) {
setTitle(title_);
window_create(window_);
window_create(window_, styleMask);
window_show(window_);
}
}
Expand Down Expand Up @@ -481,6 +481,19 @@ namespace olc {
}
}

void toggleFullScreen() noexcept {
if (window_) {
window_toggleFullScreen(window_);
}
}

bool isFullScreen() noexcept {
if (window_) {
return window_isFullScreen(window_);
}
return false;
}


// Non-copyable but movable
Window(const Window&) = delete;
Expand Down Expand Up @@ -639,6 +652,15 @@ namespace olc {
}
return false;
}

bool loadFromMemory(const uint8_t* data, size_t bytes) {
if (loader_) {
BOOL result = imageloader_loadFromMemory(loader_, data, bytes);
loaded_ = (result != 0);
return loaded_;
}
return false;
}

bool isLoaded() const noexcept {
return loaded_ && loader_ && imageloader_isLoaded(loader_);
Expand Down Expand Up @@ -876,9 +898,7 @@ namespace olc {
public:
explicit EventHandler(Window& window) noexcept : window_(window) {}

~EventHandler() noexcept {
disable();
}
~EventHandler() noexcept {}

// Event handler setters - now using template helper
void onKeyDown(std::function<void(const KeyEvent&)> handler) {
Expand Down
27 changes: 25 additions & 2 deletions dev/src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ namespace olc
{
}

PGEWindow::PGEWindow(const WindowConfig& config) : Window(config), draw()
{
}

bool PGEWindow::Create(const olc::vi2d& vScreenSize, const olc::vi2d& vPixelSize)
{
//pRenderer->RetargetDevice(pHost->GetHostWindowDescriptor(this));
Expand Down Expand Up @@ -256,7 +260,24 @@ namespace olc

bool PGEWindow::CreateImageFromMemory(olc::Image& image, const uint8_t* data, const size_t bytes, const ImageConfig& cfg)
{
olc_IgnoreUnused(image, data, bytes, cfg);
if (pImageLoader->CreateImageFromMemory(image, data, bytes))
{
// Image has loaded ok, and populated into pixel vector
//
// Create GPU Image
auto id = pRenderer->CreateTexture(image.Size(), cfg);
if (id == 0)
{
image.Create({ 0,0 });
return false;
}

// Associate CPU object with GPU Resource
image.SetGPUID(id);
return true;
}

std::cout << "Create From Memory Failed\n";
return false;
}

Expand Down Expand Up @@ -361,6 +382,8 @@ namespace olc
bool PixelGameEngine::Construct(const PGEConfig& cfg)
{
config = cfg;
// Also assign the window level config since that is what the Host will see
Window::config = cfg;

// Check for constructor sAppName, if not set use Config sAppName
if (sAppName.empty())
Expand Down Expand Up @@ -578,7 +601,7 @@ namespace olc
{
if (!pgex->OnBeforeSystemUpdate(this, fDT))
{
std::cout << "PGE OnContextTick(): User aborted in extension OnAfterUserCreate()\n";
std::cout << "PGE OnContextTick(): User aborted in extension OnBeforeSystemUpdate()\n";
return false;
}
}
Expand Down
17 changes: 15 additions & 2 deletions dev/src/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,37 @@
namespace olc
{
// A grouping of all settable PGE properties
struct PGEConfig
struct PGEConfig : public WindowConfig
{
// Size of "screen" in PGE pixels
olc::vi2d vScreenSize = { 256, 240 };
// Size of a PGE pixel
olc::vi2d vPixelSize = { 4, 4 };
// Top left location of shown main window
olc::vi2d vWindowOffset = { 30,30 };

// These three are inherited from WindowConfig
// Start in full-screen mode
bool bFullScreen = false;
// Allow full screen as an option with ALT-ENTER
bool bFullScreenable = true;
// Allow the window to be resized by user
bool bResizeable = true;
// Allow the window border to be hidden by user
bool bShowWindowBorder = true;
// Allow the window title bar to be hidden by user
bool bShowWindowTilebar = true;
// Allow the windows minimise button to be hidden by user
bool bShowWindowMinimiseButton = true;
// Allow the windows maximised button to be hidden by user
bool bShowWindowMaximiseButton = true;
// Allow the windows close button to be hidden by user
bool bShowWindowCloseButton = true;
// Synchronise rendering with monitor
bool bVSync = OLC_DEFAULT_VSYNC;
// Behave like a host window, resizing the screen in response to window resize
bool bRealWindow = false;
// Ensure aspect ratio of "screen" is mainatined regardless of window size
// Ensure aspect ratio of "screen" is maintained regardless of window size
bool bRetainAspectRatio = true;
// Force "screen" pixels to be integer in size
bool bForceIntegerPixelSize = false;
Expand All @@ -68,6 +80,7 @@ namespace olc
{
public:
PGEWindow();
PGEWindow(const WindowConfig& config);
bool Create(const olc::vi2d& vScreenSize, const olc::vi2d& vPixelSize);

public:
Expand Down
11 changes: 2 additions & 9 deletions dev/src/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,8 @@ const GPUTask& olc::Draw::FilledTriangle(const olc::vf2d& p1, const olc::vf2d& p
return FilledTriangle(p1, p2, p3, col, col, col, tint);
}



const GPUTask& olc::Draw::FilledTriangle(const olc::vf2d& p1, const olc::vf2d& p2, const olc::vf2d& p3, const olc::Pixel c1, const olc::Pixel c2, const olc::Pixel c3, const olc::Pixel tint)
{
PrepareTargetForHW();
Expand Down Expand Up @@ -946,16 +948,7 @@ GPUTask& olc::Draw::Mesh(const olc::Structure structure, const std::vector<olc::
)));
}

ImageBatch olc::Draw::CreateImageBatch(olc::Image &image)
{
PrepareImageForHW(image);
PrepareTargetForHW();

ImageBatch b;
b.task.structure = olc::Structure::List;
b.task.pImage = &image;
return b;
}


const GPUTask& olc::Draw::Image(olc::ImageRegion image, const olc::vf2d& pos, const olc::vf2d& scale, const olc::Pixel tint)
Expand Down
47 changes: 44 additions & 3 deletions dev/src/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@

[#] FilledPolygon(structure, points[], col, [tint])
[#] FilledPolygon(structure, points[], colours[], [tint])
[ ] FilledPolygon(batch, structure, points[], col)
[#] FilledPolygon(batch, structure, points[], col)
[#] FilledPolygon(batch, structure, points[], colours[])

[#] TexturedTriangle(p1, p2, p3, c1, c2, c3, uv1, uv2, uv3, image, [tint])
[ ] TexturedTriangle(batch, p1, p2, p3, c1, c2, c3, uv1, uv2, uv3, image, [tint])
[#] TexturedTriangle(batch, p1, p2, p3, c1, c2, c3, uv1, uv2, uv3, image, [tint])

[#] TexturedPolygon(structure, points[], colours[], uvs[], image, [tint])
[ ] TexturedPolygon(batch, structure, points[], colours[], uvs[], image, [tint])
[#] TexturedPolygon(batch, structure, points[], colours[], uvs[], image, [tint])

[#] String(pos, text, col, [scale], [font])
[#] StringProp(pos, text, col, [scale], [font])
Expand All @@ -152,6 +152,7 @@
[#] Batch(LineBtach, [tint])
[#] Batch(FilledBatch, [tint])
[#] Batch(ImageBatch, [tint])
[#] Batch(TexturedBatch, [tint])


3D Rendering Functions
Expand Down Expand Up @@ -186,6 +187,7 @@ namespace olc
struct ImageBatch { GPUTask task; };
struct FilledBatch { GPUTask task; };
struct LineBatch { GPUTask task; };
struct TextureBatch { GPUTask task; };

class Draw
{
Expand Down Expand Up @@ -589,6 +591,20 @@ namespace olc
const olc::Pixel col = olc::Colour::WHITE,
const olc::Pixel tint = olc::Colour::WHITE);

// Draws a textured triangle, with per vertex colouring into a batch
const TextureBatch& TexturedTriangle(
olc::TextureBatch& batch,
const olc::vf2d& p1,
const olc::vf2d& p2,
const olc::vf2d& p3,
const olc::Pixel c1,
const olc::Pixel c2,
const olc::Pixel c3,
const olc::vf2d& t1,
const olc::vf2d& t2,
const olc::vf2d& t3,
const olc::Pixel tint = olc::Colour::WHITE);

// Draws a textured triangle, with per vertex colouring
const GPUTask& TexturedTriangle(
const olc::vf2d& p1,
Expand Down Expand Up @@ -650,6 +666,14 @@ namespace olc
const std::vector<olc::Pixel>& vecColours,
const olc::Pixel tint = olc::Colour::WHITE);

// Draws a filled polygon with multiple colours into a btach
const FilledBatch& FilledPolygon(
FilledBatch& batch,
const olc::Structure structure,
const std::vector<olc::vf2d>& vecPoints,
const olc::Pixel col = olc::Colour::WHITE,
const olc::Pixel tint = olc::Colour::WHITE);

// Draws a filled polygon with multiple colours into a btach
const FilledBatch& FilledPolygon(
FilledBatch& batch,
Expand All @@ -673,6 +697,15 @@ namespace olc
const olc::Pixel tint = olc::Colour::WHITE);


// Draws a textured polygon with per vertex colouring into a batch
const TextureBatch& TexturedPolygon(
olc::TextureBatch& batch,
const olc::Structure structure,
const std::vector<olc::vf2d>& vecPoints,
const std::vector<olc::Pixel>& vecColours,
const std::vector<olc::vf2d>& vecTexCoords,
const olc::Pixel tint = olc::Colour::WHITE);


// Draws a textured polygon with per vertex colouring
const GPUTask& TexturedPolygon(
Expand Down Expand Up @@ -861,6 +894,14 @@ namespace olc
// Draws a line shape batch to the current target
const GPUTask& Batch(olc::LineBatch& batch, const olc::Pixel tint = olc::Colour::WHITE);

// Create a Textured batch for efficient repeated drawing of
// the same source texture on a polygon with per vertex colouring
TextureBatch CreateTextureBatch(olc::Image& image);

// Draws an image batch to the current target
const GPUTask& Batch(olc::TextureBatch& batch, const olc::Pixel tint = olc::Colour::WHITE);



public: // GPU Task Creator Functions (not normally called by user)
GPUTask TaskDrawLine(
Expand Down
Loading
Loading