#include #include "IrrLib.h" #include using namespace std; using namespace irr; using namespace core; using namespace scene; using namespace video; using namespace io; using namespace gui; int main(){ IrrLib Irrlicht(5, 640, 480, 16, false, true, false); bool draw = false; std::string cap; dimension2d res; position2d mxy; position2d lastmxy; res = Irrlicht.GetScreenSize(); cap = "Height in pixels: " + Irrlicht.int_to_string(res.Height) + " Width in pixels: " + Irrlicht.int_to_string(res.Width); Irrlicht.SetWindowCaption(Irrlicht.stdstring_to_stringw(cap)); while (Irrlicht.DeviceIsRunning()) if (Irrlicht.IsActiveWindow()) { Irrlicht.BeginScene(Irrlicht.Color.RED); if (Irrlicht.IrrEvent.mouseStates[0]) { Irrlicht.IrrEvent.mouseStates[0] = false; if (draw == false){ lastmxy.Y = Irrlicht.IrrEvent.getMouseY(); lastmxy.X = Irrlicht.IrrEvent.getMouseX(); draw = true; } else draw = false; } if (draw) { mxy.Y = Irrlicht.IrrEvent.getMouseY(); mxy.X = Irrlicht.IrrEvent.getMouseX(); if (mxy != lastmxy){ Irrlicht.Irr2DLib.AddLines(lastmxy, mxy, Irrlicht.Color.GREEN); lastmxy = mxy; } } Irrlicht.Irr2DLib.DrawLines(); Irrlicht.DrawAll(); Irrlicht.EndScene(); } Irrlicht.EndIrrlicht(); return 0; }