You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the old syntax (LX_<module_name>::LX_<class_name>) could be very painful in a project that use a lot of class from the library. So it could be very difficult to read and understand the code without taking a look into the documentation. This new syntax, inspired by SFML, should clarify the code and make the use of namespaces and classes in LunatiX more convenient.
Be careful, this new syntax will break backward compatibility with the previous version.
Preview (on the example code in main.cpp)
In the current version
#include<LunatiX/Lunatix.hpp>usingnamespaceLX_Event;intmain( int argc, char** argv )
{
if (!LX_Init())
{
LX_Log::log("Cannot load the library: %s", LX_getError());
return -1;
}
// Information about how to build the window
LX_Win::LX_WindowInfo info;
LX_Win::LX_loadWindowConfig(info);
info.w = 256;
info.h = 256;
LX_Win::LX_Window w(info);
const std::string s = "data/bullet.png";
LX_Graphics::LX_Sprite sprite(s, w);
const LX_Graphics::LX_ImgRect position = { { 0, 0 }, 256, 256};
LX_EventHandler ev;
bool go = true;
while (go)
{
while (ev.pollEvent())
{
switch (ev.getEventType())
{
case LX_EventType::QUIT:
go = false;
break;
default:
break;
}
}
w.clearWindow();
sprite.draw(position);
w.update();
LX_Timer::delay(33);
}
LX_Quit();
return0;
}
In the next version
#include<Lunatix/Lunatix.hpp>intmain( int argc, char** argv )
{
if ( !lx::init() )
{
lx::Log::info( "Cannot load the library: %s", LX::getError() );
return -1;
}
// Information about how to build the window
lx::Win::WindowInfo info;
lx::Win::loadWindowConfig( info );
info.w = 256;
info.h = 256;
lx::Win::Window w( info );
const std::string s = "data/bullet.png";
lx::Graphics::Sprite sprite( s, w );
const lx::Graphics::ImgRect position = { { 0, 0 }, 256, 256 };
lx::Event::EventHandler ev;
bool go = true;
while ( go )
{
while ( ev.pollEvent() )
{
switch ( ev.getEventType() )
{
case lx::Event::EventType::QUIT:
go = false;
break;
default:
break;
}
}
w.clearWindow();
sprite.draw( position );
w.update();
lx::Time::delay( 33 );
}
lx::quit();
return0;
}
The text was updated successfully, but these errors were encountered:
astyle --pad-oper --pad-paren-in --pad-header --indent=spaces=4 -A1 --align-pointer=middle --align-reference=type
lx
namespaceLX_<Module>
replaced by<Module>
LX_<Class>
replaced by<Class>
Using the old syntax (
LX_<module_name>::LX_<class_name>
) could be very painful in a project that use a lot of class from the library. So it could be very difficult to read and understand the code without taking a look into the documentation. This new syntax, inspired by SFML, should clarify the code and make the use of namespaces and classes in LunatiX more convenient.Be careful, this new syntax will break backward compatibility with the previous version.
The text was updated successfully, but these errors were encountered: