is it possible to compile irrlicht 1.9.0 on devc++4.9.9.2?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Noiecity
Posts: 363
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

is it possible to compile irrlicht 1.9.0 on devc++4.9.9.2?

Post by Noiecity »

I have a very low-resource PC, and the only compiler that doesn't freeze for 10 minutes when I try to compile something is devc++ 4.9.9.2, is it possible to compile irrlicht 1.9.0 on it? I have compiled irrlicht 1.8.5 on it, but what about 1.9.0?

https://static.wikia.nocookie.net/dota2 ... ill_09.mp3
The audio has nothing to do with it, but I wanted to share it lmao.

(It says "There's a fine line between bravery and stupidity.")
Irrlicht is love, Irrlicht is life, long live to Irrlicht
Noiecity
Posts: 363
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: is it possible to compile irrlicht 1.9.0 on devc++4.9.9.2?

Post by Noiecity »

I have tried to use the compilation that codeblocks gives me, but despite being able to run it in codeblocks 12, it does not work for dev c++ 4.9.9.2, even using the c++98 standard to compile it. When I use this compilation irrlicht it runs, but the program does not respond when starting. However, when running the same fraction of code in Codeblocks 12, it runs correctly.
Irrlicht is love, Irrlicht is life, long live to Irrlicht
Noiecity
Posts: 363
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: is it possible to compile irrlicht 1.9.0 on devc++4.9.9.2?

Post by Noiecity »

Oh! it's work!
I simply had to use an older version of codeblocks with a gcc similar to that of devc++ 4.9.9.2... fix two nullptr to be null, fix some code fractions in
source/Irrlicht/CXMLWriter.cpp

Code: Select all

CXMLWriter::CXMLWriter(IWriteFile* file) : CXMLWriterCommon(file)
to:

Code: Select all

CXMLWriter::CXMLWriter(IWriteFile* file) : CXMLWriterCommon<wchar_t>(file)
and

Code: Select all

CXMLWriterUTF8::CXMLWriterUTF8(IWriteFile* file) : CXMLWriterCommon(file)
to

Code: Select all

CXMLWriterUTF8::CXMLWriterUTF8(IWriteFile* file) : CXMLWriterCommon<char>(file)

Then simply in the lib folder, rename the files libIrrlicht.dll.a and libIrrlicht.dll.ref without the ".dll" that for some reason was saved like this...
Then you simply copy the .dev files for the examples... hello world from irrlicht 1.8.5 for example, only copy the .dev file(it is already configured with the paths and files used).

I used codeblocks 1.0 and set the project to build options with -std=c++98(I don't know if it's relevant, I think it was already compatible with c++98 by default)

Interesting, deactivating mipmaps and filters does work in irrlicht 1.9.0, in 1.8.5 even if you deactivated them they were still active.( EDIT: okay, it's not that mipmaps couldn't be disabled, it was something simpler than that, it was where you disabled it, I tried disabling it before loading the models and it worked.)

However, I only see that disabling mipmaps takes 1-2 fps off, and the bilinear filter takes another 2-3 fps. That is, it is quite cheap to have them active. In d3d9 use bilinear on the contrary, I get more fps lmao.

I think I will leave mipmaps active, and I think I will use textures already preloaded with some Gaussian filter instead of having the bilinear filter. Without mipmaps everything is distorted into pixels in the distance.
Last edited by Noiecity on Thu Mar 05, 2026 9:32 pm, edited 1 time in total.
Irrlicht is love, Irrlicht is life, long live to Irrlicht
CuteAlien
Admin
Posts: 9969
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: is it possible to compile irrlicht 1.9.0 on devc++4.9.9.2?

Post by CuteAlien »

Thanks for info. I'll have to check that code, could be that always should put the template parameter there as well (or won't hurt at least on other compilers). I'll check some time in future (have to put everything on TODO again, this week I've either got a bad flu or Corona again).

Mipmaps in hardware drivers should only use some texture memory and cost a bit when creating/modifying textures.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Noiecity
Posts: 363
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: is it possible to compile irrlicht 1.9.0 on devc++4.9.9.2?

Post by Noiecity »

CuteAlien wrote: Wed Mar 04, 2026 11:27 pm Thanks for info. I'll have to check that code, could be that always should put the template parameter there as well (or won't hurt at least on other compilers). I'll check some time in future (have to put everything on TODO again, this week I've either got a bad flu or Corona again).

Mipmaps in hardware drivers should only use some texture memory and cost a bit when creating/modifying textures.
Thanks mr cuteAlien.

I was running burningsvideo, and tried using "mesa" to test emulating opengl32.dll, however it was not compatible with windows xp. However, someone published a version compatible with it:
https://github.com/JHRobotics/mesa9x/re ... vmpipe.zip

Code: Select all

/** Example 002 Quake3Map - Modified for scaled render to texture
    Internally renders at 128x128 and then scales to the window. */

#include <irrlicht.h>
//#include "driverChoice.h"
#include "exampleHelper.h"

using namespace irr;

#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
int width_window=800;
int height_windows=600;

int width_render=128;
int height_render=128;

int main()
{
	// ask user for driver
/*	video::E_DRIVER_TYPE driverType = driverChoiceConsole(true);
	if (driverType == video::EDT_COUNT)
		return 1;*/

	// create device
	IrrlichtDevice *device =
		createDevice(video::EDT_OPENGL, core::dimension2d<u32>(width_window, height_windows));
	if (device == 0)
		return 1;

	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();

	// add quake3 archive
	device->getFileSystem()->addFileArchive(getExampleMediaPath() + "map-20kdm2.pk3");


	driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);

	// load quake3 mesh
	scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
	scene::ISceneNode* node = 0;

	if (mesh)
		node = smgr->addOctreeSceneNode(mesh->getMesh(0), 0, -1, 1024);

	if (node)
	{
		for (u32 m = 0; m < node->getMaterialCount(); ++m)
		{
			video::SMaterial& mat = node->getMaterial(m);
			// Disable mipmaps in material (just in case)
			mat.setFlag(video::EMF_USE_MIP_MAPS, true);
			mat.setFlag(video::EMF_BILINEAR_FILTER, true);
		}
	}

	if (node)
		node->setPosition(core::vector3df(-1300, -144, -1249));

	// add fps camera
	scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();

	// --- NEW: Set FOV to 54 degrees ---
	if (camera)
		camera->setFOV(54 * core::DEGTORAD);

	device->getCursorControl()->setVisible(false);

	// --- NEW: Create 128x128 render-to-texture (RTT) ---
	core::dimension2d<u32> rttSize(width_render, height_render);
	video::ITexture* renderTarget = driver->addRenderTargetTexture(rttSize, "RTT", video::ECF_A8R8G8B8);

	if (!renderTarget)
	{
		device->drop();
		return 1;
	}
	
	video::SMaterial& mat2D = driver->getMaterial2D();
	mat2D.TextureLayer[0].BilinearFilter = true;
	mat2D.AntiAliasing = video::EAAM_OFF;
	driver->enableMaterial2D(true);
 
	
	int lastFPS = -1;

	while (device->run())
	{
		if (device->isWindowActive())
		{
			// --- 1. Render the 3D scene to the 128x128 texture ---
			driver->setRenderTarget(renderTarget, true, true, video::SColor(255, 0, 0, 0));
			smgr->drawAll();
			driver->setRenderTarget(0);

			// --- 2. Draw the scaled texture to the window while maintaining aspect ratio ---
			driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 0, 0, 0));

			// Get current window size
			const core::dimension2d<u32>& screenSize = driver->getScreenSize();
			f32 screenW = (f32)screenSize.Width;
			f32 screenH = (f32)screenSize.Height;

			// RTT texture size
			f32 rttW = (f32)rttSize.Width;
			f32 rttH = (f32)rttSize.Height;
			f32 rttAspect = rttW / rttH;

			// Calculate destination rectangle that maintains the proportion
			f32 destW, destH;
			if (rttAspect > screenW / screenH)
			{
				// Width limiting
				destW = screenW;
				destH = screenW / rttAspect;
			}
			else
			{
				// Height limiting
				destH = screenH;
				destW = screenH * rttAspect;
			}

			// Center on screen
			s32 destX = (s32)((screenW - destW) * 0.5f);
			s32 destY = (s32)((screenH - destH) * 0.5f);
			core::rect<s32> destRect(destX, destY, destX + (s32)destW, destY + (s32)destH);

			// Draw the scaled RTT texture without distortion
			driver->draw2DImage(renderTarget,
				destRect,                               // destination: rectangle with preserved aspect
				core::rect<s32>(0, 0, rttSize.Width, rttSize.Height), // source: entire texture
				0, 0, true);

			driver->endScene();

			// Update title with FPS
			int fps = driver->getFPS();
			if (lastFPS != fps)
			{
				core::stringw str = L"Irrlicht Engine - Quake 3 Map example [RTT 128x128 scaled, aspect ratio kept] FPS:";
				str += fps;
				device->setWindowCaption(str.c_str());
				lastFPS = fps;
			}
		}
		device->yield();
	}

	device->drop();
	return 0;
}

I got a little more than double the fps than using burningsvideo, emulating opengl with the CPU using this dll (just copying opengl32.dll to the executable path).
"including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software."
Mesa is a huge project (millions of lines) with mixed licenses, mainly:

M.I.T.

BSD

SGI FreeB

Apache 2.0

All allow commercial use, but require maintaining copyright notices.
I read that credits can be included in a .txt file.

The isometric graphics work now, with cpu.

Code: Select all

/** Example 002 Quake3Map - Modified for scaled render to texture with true isometric camera
    Internally renders at 128x128 and then scales to the window. */

#include <irrlicht.h>
//#include "driverChoice.h"
#include "exampleHelper.h"

using namespace irr;

#ifdef _MSC_VER
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#pragma comment(lib, "Irrlicht.lib")
#endif
int width_window=800;
int height_windows=600;

int width_render=128;
int height_render=128;

int main()
{
	// create device
	IrrlichtDevice *device =
		createDevice(video::EDT_OPENGL, core::dimension2d<u32>(width_window, height_windows));
	if (device == 0)
		return 1;

	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();

	// add quake3 archive
	device->getFileSystem()->addFileArchive(getExampleMediaPath() + "map-20kdm2.pk3");

	driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);

	// load quake3 mesh
	scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
	scene::ISceneNode* node = 0;

	if (mesh)
		node = smgr->addOctreeSceneNode(mesh->getMesh(0), 0, -1, 1024);

	if (node)
	{
		for (u32 m = 0; m < node->getMaterialCount(); ++m)
		{
			video::SMaterial& mat = node->getMaterial(m);
			mat.setFlag(video::EMF_USE_MIP_MAPS, true);
			mat.setFlag(video::EMF_BILINEAR_FILTER, true);
		}
	}

	if (node)
		node->setPosition(core::vector3df(-1300, -144, -1249));

	// --- True isometric camera (orthographic) using manual projection matrix ---
	scene::ICameraSceneNode* camera = smgr->addCameraSceneNode();
	if (camera)
	{
		// Target the center of the map (node's position)
		core::vector3df target = node ? node->getPosition() : core::vector3df(0,0,0);
		
		// Place camera along the (1,1,1) direction to achieve isometric view
		f32 distance = 2000.0f; // can be adjusted
		core::vector3df pos = target + core::vector3df(distance, distance, distance);
		camera->setPosition(pos);
		camera->setTarget(target);

		// Set up orthographic projection matrix
		// Compute size based on the scene bounding box
		f32 orthoSize = 3000.0f; // fallback
		if (node)
		{
			core::aabbox3df bbox = node->getTransformedBoundingBox();
			f32 maxExtent = bbox.getExtent().getLength();
			// Add some margin to fit the scene nicely
			orthoSize = maxExtent * 1.5f;
		}

		// For a square render target (128x128), we want a square orthographic projection
		// Left = -orthoSize/2, Right = orthoSize/2, Bottom = -orthoSize/2, Top = orthoSize/2
		// Near and far planes: choose appropriate values
		f32 nearPlane = 0.1f;
		f32 farPlane = 10000.0f;

		core::matrix4 projMatrix;
		projMatrix.buildProjectionMatrixOrthoLH(orthoSize, orthoSize, nearPlane, farPlane);
		camera->setProjectionMatrix(projMatrix, true);
	}

	// Make cursor visible (not needed for static isometric camera)
	device->getCursorControl()->setVisible(true);

	// --- Create 128x128 render-to-texture (RTT) ---
	core::dimension2d<u32> rttSize(width_render, height_render);
	video::ITexture* renderTarget = driver->addRenderTargetTexture(rttSize, "RTT", video::ECF_A8R8G8B8);

	if (!renderTarget)
	{
		device->drop();
		return 1;
	}
	video::SMaterial& mat2D = driver->getMaterial2D();
	mat2D.TextureLayer[0].BilinearFilter = true;
	mat2D.AntiAliasing = video::EAAM_OFF;
	driver->enableMaterial2D(true);
 
	
	int lastFPS = -1;

	while (device->run())
	{
		if (device->isWindowActive())
		{
			// --- 1. Render the 3D scene to the 128x128 texture ---
			driver->setRenderTarget(renderTarget, true, true, video::SColor(255, 0, 0, 0));
			smgr->drawAll();
			driver->setRenderTarget(0);

			// --- 2. Draw the scaled texture to the window while maintaining aspect ratio ---
			driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 0, 0, 0));

			const core::dimension2d<u32>& screenSize = driver->getScreenSize();
			f32 screenW = (f32)screenSize.Width;
			f32 screenH = (f32)screenSize.Height;

			f32 rttW = (f32)rttSize.Width;
			f32 rttH = (f32)rttSize.Height;
			f32 rttAspect = rttW / rttH;

			f32 destW, destH;
			if (rttAspect > screenW / screenH)
			{
				destW = screenW;
				destH = screenW / rttAspect;
			}
			else
			{
				destH = screenH;
				destW = screenH * rttAspect;
			}

			s32 destX = (s32)((screenW - destW) * 0.5f);
			s32 destY = (s32)((screenH - destH) * 0.5f);
			core::rect<s32> destRect(destX, destY, destX + (s32)destW, destY + (s32)destH);

			driver->draw2DImage(renderTarget,
				destRect,
				core::rect<s32>(0, 0, rttSize.Width, rttSize.Height),
				0, 0, true);

			driver->endScene();

			// Update title with FPS
			int fps = driver->getFPS();
			if (lastFPS != fps)
			{
				core::stringw str = L"Irrlicht Engine - Quake 3 Map [True Isometric, RTT 128x128 scaled] FPS:";
				str += fps;
				device->setWindowCaption(str.c_str());
				lastFPS = fps;
			}
		}
		device->yield();
	}

	device->drop();
	return 0;
}

Image

With material2d enabled for the render to texture, and bilinear filter:
Image
Irrlicht is love, Irrlicht is life, long live to Irrlicht
Noiecity
Posts: 363
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: is it possible to compile irrlicht 1.9.0 on devc++4.9.9.2?

Post by Noiecity »

A slightly more complete example of the isometric view.

Image

Code: Select all

/** Example 002 Quake3Map - Modified for scaled render to texture with true isometric camera
    Internally renders at 128x128 and then scales to the window.
    True isometric camera with fixed view direction and panning capability. */

#include <irrlicht.h>
#include "exampleHelper.h"

using namespace irr;

#ifdef _MSC_VER
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#pragma comment(lib, "Irrlicht.lib")
#endif

int width_window = 800;
int height_windows = 600;

int width_render = 128;
int height_render = 128;

// ---------------------------------------------------------------------------
// Camera controller class – with orthographic zoom support
// ---------------------------------------------------------------------------
class IsometricCameraController
{
private:
    scene::ICameraSceneNode* camera;
    core::vector3df viewDirection;
    core::vector3df targetPoint;
    f32 orthoSize;
    f32 minOrthoSize;
    f32 maxOrthoSize;

public:
    IsometricCameraController(scene::ICameraSceneNode* cam, const core::vector3df& center,
                              const core::vector3df& dir, f32 initialOrthoSize)
        : camera(cam), targetPoint(center), viewDirection(dir), orthoSize(initialOrthoSize)
    {
        viewDirection.normalize();
        minOrthoSize = orthoSize * 0.1f;
        maxOrthoSize = orthoSize * 3.0f;
        updateCamera();
    }

    void updateCamera()
    {
        // Update camera position based on target and direction
        core::vector3df camPos = targetPoint + viewDirection * (orthoSize * 2.0f);
        camera->setPosition(camPos);
        camera->setTarget(targetPoint);
        
        // Update orthographic projection matrix with new orthoSize
        f32 nearPlane = 0.1f;
        f32 farPlane = 10000.0f;
        
        core::matrix4 projMatrix;
        projMatrix.buildProjectionMatrixOrthoLH(orthoSize, orthoSize, nearPlane, farPlane);
        camera->setProjectionMatrix(projMatrix, true);
    }

    void pan(const core::vector3df& delta)
    {
        targetPoint += delta;
        updateCamera();
    }

    void zoom(f32 delta)
    {
        orthoSize += delta;
        // Clamp orthoSize to reasonable range
        if (orthoSize < minOrthoSize) orthoSize = minOrthoSize;
        if (orthoSize > maxOrthoSize) orthoSize = maxOrthoSize;
        updateCamera();
    }

    void setTarget(const core::vector3df& newTarget)
    {
        targetPoint = newTarget;
        updateCamera();
    }

    core::vector3df getTarget() const { return targetPoint; }
    f32 getOrthoSize() const { return orthoSize; }
};

// ---------------------------------------------------------------------------
// Event receiver for keyboard input – corrected pan directions
// ---------------------------------------------------------------------------
class MyEventReceiver : public IEventReceiver
{
public:
    MyEventReceiver(IsometricCameraController* controller) : CameraController(controller) {}

    virtual bool OnEvent(const SEvent& event)
    {
        if (event.EventType == EET_KEY_INPUT_EVENT && CameraController)
        {
            if (event.KeyInput.PressedDown)
            {
                f32 panSpeed = 20.0f;
                f32 zoomSpeed = 5.0f; // Smaller steps for orthographic zoom
                core::vector3df delta(0,0,0);

                switch(event.KeyInput.Key)
                {
                // Corrected pan directions for intuitive movement
                case KEY_LEFT:  delta = core::vector3df(0, 0,  -panSpeed); break; // Move view left (camera moves right in world)
                case KEY_RIGHT: delta = core::vector3df(0, 0, panSpeed); break; // Move view right (camera moves left in world)
                case KEY_UP:    delta = core::vector3df( -panSpeed, 0, 0); break; // Move view up (camera moves down in world)
                case KEY_DOWN:  delta = core::vector3df(panSpeed, 0, 0); break; // Move view down (camera moves up in world)

                // Zoom with PageUp/PageDown
                case KEY_PRIOR: // PageUp
                    CameraController->zoom(-zoomSpeed);
                    break;
                case KEY_NEXT:  // PageDown
                    CameraController->zoom(zoomSpeed);
                    break;

                // Zoom with Space (out) and Ctrl (in)
                case KEY_SPACE:
                    CameraController->zoom(zoomSpeed);
                    break;
                case KEY_LCONTROL:
                case KEY_RCONTROL:
                    CameraController->zoom(-zoomSpeed);
                    break;

                case KEY_KEY_R: // R key – reset view
                    {
                        // Reset to initial view (would need to store initial values)
                        // For now, just a placeholder
                    }
                    break;
                default:
                    break;
                }

                if (delta.getLength() > 0)
                    CameraController->pan(delta);
            }
            return true;
        }
        return false;
    }

private:
    IsometricCameraController* CameraController;
};

// ---------------------------------------------------------------------------
// Main
// ---------------------------------------------------------------------------
int main()
{
    // Create device
    IrrlichtDevice *device =
        createDevice(video::EDT_OPENGL, core::dimension2d<u32>(width_window, height_windows));
    if (device == 0)
        return 1;

    video::IVideoDriver* driver = device->getVideoDriver();
    scene::ISceneManager* smgr = device->getSceneManager();
    gui::IGUIEnvironment* gui = device->getGUIEnvironment();

    // Add quake3 archive
    device->getFileSystem()->addFileArchive(getExampleMediaPath() + "map-20kdm2.pk3");

    driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);

    // Load quake3 mesh
    scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
    scene::ISceneNode* node = 0;

    if (mesh)
        node = smgr->addOctreeSceneNode(mesh->getMesh(0), 0, -1, 1024);

    if (node)
    {
        for (u32 m = 0; m < node->getMaterialCount(); ++m)
        {
            video::SMaterial& mat = node->getMaterial(m);
            mat.setFlag(video::EMF_USE_MIP_MAPS, true);
            mat.setFlag(video::EMF_BILINEAR_FILTER, true);
        }
    }

    if (node)
        node->setPosition(core::vector3df(-1300, -144, -1249));

    // --- True isometric camera (orthographic) with fixed view direction ---
    scene::ICameraSceneNode* camera = smgr->addCameraSceneNode();
    IsometricCameraController* camController = 0;

    if (camera && node)
    {
        // Calculate scene center from node bounding box
        core::aabbox3df bbox = node->getTransformedBoundingBox();
        core::vector3df sceneCenter = bbox.getCenter();
        
        // True isometric direction: (1,1,1) normalized
        core::vector3df isoDirection(1.0f, 1.0f, 1.0f);
        isoDirection.normalize();
        
        // Calculate initial ortho size based on scene size
        f32 maxExtent = bbox.getExtent().getLength();
        f32 initialOrthoSize = maxExtent * 0.5f;
        
        // Create camera controller
        camController = new IsometricCameraController(camera, sceneCenter, isoDirection, initialOrthoSize);
        
        printf("True isometric camera initialized.\n");
        printf("Initial ortho size: %.2f\n", initialOrthoSize);
    }

    // Set up event receiver
    MyEventReceiver receiver(camController);
    device->setEventReceiver(&receiver);

    // Make cursor visible
    device->getCursorControl()->setVisible(true);

    // --- Create 128x128 render-to-texture (RTT) ---
    core::dimension2d<u32> rttSize(width_render, height_render);
    video::ITexture* renderTarget = driver->addRenderTargetTexture(rttSize, "RTT", video::ECF_A8R8G8B8);

    if (!renderTarget)
    {
        device->drop();
        return 1;
    }
    
    // Setup 2D material for scaling
    video::SMaterial& mat2D = driver->getMaterial2D();
    mat2D.TextureLayer[0].BilinearFilter = true;
    mat2D.AntiAliasing = video::EAAM_OFF;
    driver->enableMaterial2D(true);
    
    // Add some GUI text for instructions
    gui::IGUIStaticText* instructions = gui->addStaticText(
        L"True Isometric Camera Demo\n"
        L"Arrow Keys: Pan camera (corrected directions)\n"
        L"PageUp / Ctrl: Zoom in\n"
        L"PageDown / Space: Zoom out\n"
        L"R: Reset view (not implemented)",
        core::rect<s32>(10, 10, 350, 120),
        true, true, 0, -1, true);
    
    int lastFPS = -1;

    while (device->run())
    {
        if (device->isWindowActive())
        {
            // --- 1. Render the 3D scene to the 128x128 texture ---
            driver->setRenderTarget(renderTarget, true, true, video::SColor(255, 0, 0, 0));
            smgr->drawAll();
            // Do not draw GUI to RTT
            driver->setRenderTarget(0);

            // --- 2. Draw the scaled texture to the window while maintaining aspect ratio ---
            driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255, 0, 0, 0));

            const core::dimension2d<u32>& screenSize = driver->getScreenSize();
            f32 screenW = (f32)screenSize.Width;
            f32 screenH = (f32)screenSize.Height;

            f32 rttW = (f32)rttSize.Width;
            f32 rttH = (f32)rttSize.Height;
            f32 rttAspect = rttW / rttH;

            f32 destW, destH;
            if (rttAspect > screenW / screenH)
            {
                destW = screenW;
                destH = screenW / rttAspect;
            }
            else
            {
                destH = screenH;
                destW = screenH * rttAspect;
            }

            s32 destX = (s32)((screenW - destW) * 0.5f);
            s32 destY = (s32)((screenH - destH) * 0.5f);
            core::rect<s32> destRect(destX, destY, destX + (s32)destW, destY + (s32)destH);

            // Draw the scaled RTT
            driver->draw2DImage(renderTarget,
                destRect,
                core::rect<s32>(0, 0, rttSize.Width, rttSize.Height),
                0, 0, true);

            // Draw the GUI (instructions) on top of the scaled image
            gui->drawAll();

            driver->endScene();

            // Update title with FPS
            int fps = driver->getFPS();
            if (lastFPS != fps)
            {
                core::stringw str = L"Irrlicht Engine - Quake 3 Map [True Isometric, RTT 128x128 scaled] FPS:";
                str += fps;
                device->setWindowCaption(str.c_str());
                lastFPS = fps;
            }
        }
        device->yield();
    }

    // Clean up
    if (camController)
        delete camController;
    
    device->drop();
    return 0;
}
Irrlicht is love, Irrlicht is life, long live to Irrlicht
CuteAlien
Admin
Posts: 9969
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: is it possible to compile irrlicht 1.9.0 on devc++4.9.9.2?

Post by CuteAlien »

Nice, really gives this old-time games feeling! (I was a huge Diablo2 fan back in the days)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
wizard4
Posts: 199
Joined: Thu Jan 25, 2024 6:54 pm
Location: UK

Re: is it possible to compile irrlicht 1.9.0 on devc++4.9.9.2?

Post by wizard4 »

I'm sorry... Do I see a Quake3 bsp example map running in perfect isometric with a filters applied and also the source? This man is a genius.
Noiecity
Posts: 363
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: is it possible to compile irrlicht 1.9.0 on devc++4.9.9.2?

Post by Noiecity »

yes, thanks chadgpt(well actually it was deepseek)
Irrlicht is love, Irrlicht is life, long live to Irrlicht
Post Reply