Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

My version of "Hello, World!": Goldenrod Spaceship!

33 views
Skip to first unread message

Mr Flibble

unread,
Mar 1, 2016, 1:15:34 PM3/1/16
to
I have decided to change the scope of my C++ GUI library "neogfx": it
will now be a combined GUI/game library.

Here is what Goldenrod Spaceship Hello, World! looks like using neogfx:

#include <neogfx/neogfx.hpp>
#include <neogfx/app.hpp>
#include <neogfx/window.hpp>
#include <neogfx/vertical_layout.hpp>
#include <neogfx/sprite.hpp>
#include <neogfx/sprite_plane.hpp>
#include <neogfx/image.hpp>

namespace ng = neogfx;

const uint8_t sSpaceShip[8][8]
{
{ 0, 0, 0, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 0, 0, 0 },
{ 0, 0, 1, 0, 0, 1, 0, 0 },
{ 0, 0, 1, 0, 0, 1, 0, 0 },
{ 0, 1, 1, 0, 0, 1, 1, 0 },
{ 0, 1, 0, 1, 1, 0, 1, 0 },
{ 0, 1, 0, 0, 0, 0, 1, 0 },
};

int main()
{
ng::app app("neopede - neoGFX Sample Application");
ng::window window(800, 800);
ng::vertical_layout layout0(window);
ng::sprite_plane spritePlane(layout0);
spritePlane.set_background_colour(ng::colour::Black);
auto& sprite = spritePlane.create_sprite(ng::image(sSpaceShip, {{0,
ng::colour()}, {1, ng::colour::Goldenrod}}));
sprite.set_size(ng::size(32.0, 32.0));
return app.exec();
}

http://neogfx.org/temp/hello.png

/Flibble
0 new messages