Tilengine - The 2D retro graphics engine forum
Microsoft Windows integration? - Printable Version

+- Tilengine - The 2D retro graphics engine forum (http://tilengine.org/forum)
+-- Forum: English forums (http://tilengine.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (http://tilengine.org/forum/forumdisplay.php?fid=7)
+--- Thread: Microsoft Windows integration? (/showthread.php?tid=955)

Pages: 1 2


Microsoft Windows integration? - constructworker - 12-10-2020

So how would tilengine be setup to render into a native win32 application? 
I'm familiar with how to setup a win32 program and make a window/process messages.


RE: Microsoft Windows integration? - megamarc - 12-10-2020

Hi,

I don't quite understand what you mean with a "native win32 application". When you compile a program that uses Tilengine with Visual Studio or mingw32, the resulting executable is a native win32 application, you cannot run in under linux or in a raspberry. The generated window is a native win32 window too.


RE: Microsoft Windows integration? - constructworker - 12-11-2020

(12-10-2020, 05:34 PM)megamarc Wrote: Hi,

I don't quite understand what you mean with a "native win32 application". When you compile a program that uses Tilengine with Visual Studio or mingw32, the resulting executable is a native win32 application, you cannot run in under linux or in a raspberry. The generated window is a native win32 window too.

Hi, well in the docs it uses a built-in tilengine function to make a window without invoking win32 api functions, but
afaict the docs say you can use the tilengine with any operating system to render to their native windows.
For instance  
Code:
HWND window;
CreateWindowExW();
using the HWND surface as the render target instead of the tileengines
Code:
TLN_createwindow()
In other words setting up the win32 app like normal but then just using the tilengine to render. I thought
the docs say you can use tilengine as a slave renderer?
I was under the impression it was used much like Vulkan in that you can use a win32 surface and then make a compatible surface with vulkan to render to.


RE: Microsoft Windows integration? - System64 - 12-11-2020

It uses SDL2 to display graphics.
not sure if it uses hardware acceleration to display them, but it may use Open GL since it's open source and cross-platform, but again, not sure at all.

Update : It uses OpenGL


RE: Microsoft Windows integration? - megamarc - 12-11-2020

Hi,
Yes, you can use Tilengine without its built-in window. In this case is up to you, the integrator, to create the render target in your windowing environment. Tilengine expects a 32-bit RGBA surface. This chapter in the documentation gives the details:
http://www.tilengine.org/doc/md_rendering.html

In Windows, you must use DirectDraw, Direct3D, OpenGL or whatever graphics API that allows you to create and use RGBA surfaces. The built-in window uses the cross-platform library SDL2, that in turn selects the best graphics API available on host operating system. Tilengine itself doesn't require any kind of graphic acceleration, you can even draw to a memory buffer.

This example showcases how to draw to a Java applet:
https://github.com/megamarc/JTilengine/blob/master/TestPanel.java

And here is a tutorial on how to integrate inside a Unity project:
http://madwonder.com/tilengine-embedding-unity/

Even if you check the source code of Window.c, you can see how the built-in window uses SDL2:
https://github.com/megamarc/Tilengine/blob/e0e3a2cdedaf7a856a7d139df224dbf755eaf86c/src/Window.c#L999


RE: Microsoft Windows integration? - System64 - 12-11-2020

Does the base Tilengine use hardware acceleration?


RE: Microsoft Windows integration? - megamarc - 12-11-2020

No, the base Tilengine doesn't use hardware acceleration at all, it's entirely software based on CPU alone. SDL2 library that underpins the built-in window does use hardware acceleration.


RE: Microsoft Windows integration? - System64 - 12-11-2020

Ah I understand why it takes half of my GPU now. How can I enable it?


RE: Microsoft Windows integration? - megamarc - 12-12-2020

Sorry I don't understand the question. Enable what?
If GPU usage is high, you may have a low-end system. Disable CRT effect (enabled by default) by pressing "backspace" key once


RE: Microsoft Windows integration? - System64 - 12-12-2020

Sorry if my question wasn't clear, I meant, how can I enable hardware acceleration support?