Giter Site home page Giter Site logo

lairworks / nas2d-core Goto Github PK

View Code? Open in Web Editor NEW
10.0 6.0 6.0 31.33 MB

NAS2D is an open source, object oriented 2D game development framework written in portable C++.

Home Page: http://nas2d.lairworks.com

License: zlib License

C++ 94.16% C 1.21% Makefile 2.60% Dockerfile 1.89% Batchfile 0.15%
game framework 2d-framework 2d-game-framework

nas2d-core's Introduction

NAS2D: Core

AppVeyor CircleCI Codacy Badge

NAS2D is an open source, object oriented 2D game development framework written in portable C++. It was designed to make the development of games and other applications that needed a 2D interface easier by providing a high-level interface. It handles the low-level tasks of setting up the video display, input, sound mixing, file loading, etc.

One of the primary goals of NAS2D was to be cross-platform. A lot of effort has gone into the code to make it as platform independant as possible. The few areas that are different from platform to platform are hidden from the interface and is virtually transparent to the user.

Why another 2D API

NAS2D isn't just another 2D renderer. It's a complete set of classes and functions that let you jump into building a game right away.

What Platforms are Supported

Officially, NAS2D is supported on Windows (Vista+) and MacOS X (10.8+). Binaries, source code and IDE Project files are provided and maintained for these platforms.

NAS2D has been tested and works on Linux and BSD but there are no official maintainers for these platforms.

NAS2D's History

NAS2D was born from the development efforts of another LairWorks project, The Legend of Mazzeroth. After several months of development it became clear that core code that LoM was built on didn't change very much. We cleaned it up, pulled it out of the LoM project, repackaged it and the first version of NAS2D was released.

License

NAS2D is licensed under the zlib license. See LICENSE.txt for details.

nas2d-core's People

Contributors

allenmoatallen avatar brett208 avatar codacy-badger avatar cugone avatar danrstevens avatar ldicker83 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nas2d-core's Issues

Add functions to get desktop display mode

Title says it all.

At the moment I use raw SDL functions to get the native desktop screen resolution. While this works it would be better for NAS2D to provide functions for this. These don't need to be part of the renderer as the video subsystem doesn't need to be initialized. I suppose these could be called convenience functions.

Anyway, the following functions should be provided:


int desktop_width();
int desktop_height();
Point_2d desktop_size();

Remove Renderer::drawImageRect()

Title says it all. This is an extremely inefficient function and somewhat poorly implemented.

The ImageRectangle graphics primitive will replace this functionality.

Clean out repository cruft

There is 20MB of data in proj/xcode. I suspect most of it is either automated downloads for a local MacOS environment, or build output for MacOS. Either way, I don't think it should be there. Automated dependency downloads are typically listed in the .gitignore file, as are build outputs.

Update Filesystem exceptions

The exception hierarchy and error reporting could perhaps be re-worked a bit.

For PhysFS errors, the error could be captured inside an exception constructor, simplifying the calling code quite a bit. This may also ease transition from the now deprecated getLastError and help transition to getLastErrorCode and getErrorByCode.

Currently error messages are being dumped to cout. Better would be to report errors to cerr. Best would be to capture the message in the exception itself. If the exception message is logged in caller, it can log it to cerr, or whatever log file it produces.


I believe the exceptions should be more closely tied to the component they are associated with. Currently the filesystem related exceptions are in a generic Exception.h. I think it would be better to keep the filesystem specific exceptions as part of the Filesystem class, perhaps as contained classes.


I believe there should be a common filesystem related base class for all filesystem exceptions. Currently each one derives from runtime_error directly.

I'm uncertain if we need the granular detail of having separate exception classes for each of the possible filesystem errors. Currently we have:

  • filesystem_backend_init_failure
  • filesystem_not_initialized
  • filesystem_already_initialized
  • filesystem_file_handle_still_open

In particular, the PhysFS library already checks and reports many of these conditions. We could have just a generic exception which captures the PhysFS error and reports that.

NULL Sound Driver crashes on exit

When no sound devices are available, NAS2D is supposed to create a NULL Sound Driver. In these cases when the Game object goes to clean itself up, applications crash when it comes time to destroy the Sound Mixer.

Not sure exactly why this is -- either a sound driver is never created and we're trying to delete a null pointer or the null sound driver does something that accesses or frees a null pointer.

Font copy operator & c'tor broken

While inspecting the code for the Music class, I realized that there's a mistake in the copy c'tor and copy operator. The reference count for the previous reference is never decremented. While this doesn't cause a problem in the case of an empty or default constructed Font, in any other case resources are leaked.

This issue also affects Music and Image classes.

Renderer: Dynamically switch between Fullscreen and Windowed modes

Currently the only way to switch between windowed and fullscreen modes is to destroy the Renderer object and reinstantiate it. This works but also invalidates all OpenGL Texture ID's for Images and Fonts.

A quick work around to this is to have the OpenGL Renderer go through all of the Image and Font tables and release all OpenGL Texture ID's, then when the Renderer is reinitialized check these tables for entries and reload them.

This works but is not ideal as it would require a reload of all assets that require FBO's, VBO's and Texture ID's which can cause long delays.

A better option would be to have the Renderer respond to window sizing events and simply reset the viewport and window context settings. Need to test this to see if it's possible using SDL2 to handle OpenGL contexts.

Crash bug in Filesystem

The Filesystem object will unconditionally call PHYSFS_deinit() in the destructor. However, the corresponding PHYSFS_init(argv_0) call is not placed in the constructor, but rather deferred until init(...) is called. This means a Filesystem object can not be safely destructed until after init(...) has been called.

The following may exhibit the crash behavior:

{  // Scope block
  NAS2D::Filesystem fs;  // Construct object (do not call init)
}  // Object goes out of scope and destructor is called

GDB backtrace (most recent call first):

#0  0x0000000000000000 in ?? ()
#1  0x00007ffff6a2815a in PHYSFS_setErrorCode ()
   from /usr/local/lib/libphysfs.so.1
#2  0x00007ffff6a2958f in PHYSFS_deinit () from /usr/local/lib/libphysfs.so.1
#3  0x0000000000408c09 in NAS2D::Filesystem::~Filesystem (this=0x7fffffffcfc0)
    at src/Filesystem.cpp:50

Suggested fix:
Move the contents of init into the constructor. That way the object is always fully formed, and can be safely destructed.

Side note: As the Utility class template was updated to allow passing arbitrary parameters to the constructor, this should be easier to manage now.

Related: Merging init into the constructor may also allow for elimination of the FILESYSTEM_INITIALIZED checks. If the object is fully constructed, and so there is a this object to refer to, then initialization has already run. Access to Filesystem methods will then be statically checked due to the program's structure. Therefor there will be no need for runtime checks.

Fix AppVeyor config on GitHub

The AppVeyor builds are not currently working. The most recent failure is:
https://ci.appveyor.com/project/OPU/nas2d-core

Error fetching YAML configuration file from the repository. Make sure AppVeyor is authorized to access your gitHub account: AppVeyor GitHub App is not installed for account "lairworks".

This likely needs some attention by a repository administrator on GitHub.

The relevant settings are probably under the following two sections:
https://github.com/lairworks/nas2d-core/settings/installations
https://github.com/lairworks/nas2d-core/settings/hooks

Image copy operator and c'tor broken

While inspecting the code for the Music class, I realized that there's a mistake in the copy c'tor and copy operator. The reference count for the previous reference is never decremented. While this doesn't cause a problem in the case of an empty or default constructed Image, in any other case resources are leaked.

This issue also affects Music and Font classes.

Deprecate Exception class

In an effort to reduce unnecessary code and to conform with modern C++ standards, the Exception class should be deprecated in favor of using exception classes derived from std::runtime_exception. This will provide a much cleaner interface, allows the rest of the library to throw specific exception types where applicable and set exception messages using a standard interface.


To be removed by v1.4.0

Rename screenCenterX/screenCenterY functions

In an effort to continue cleaning up the NAS2D interface and get everything consistent, these functions in the Renderer interface should be renamed to simply center_x and center_y. This will be interface breaking but it's a simple enough change.

Music's Copy C'tor and Copy Asignment Operator Broken

These two function copy the most basic information and even update the reference counts to the data they're supposed to represent but the data itself isn't made available to copied objects. This leads to problems where you would expect to be able to use a copy constructed or assignment copied object but the data needed for proper use is not available.

For example:

Music music("some_track.ogg");
Music music_copy = music;

In this case, music_copy has all of the information in music except for the raw data itself. Calling Mixer::playMusic(music); will work perfectly fine. Calling Mixer::playMusic(music_copy); will result in an error and silence.

This is related in a lot of ways to the Image class's problem of the raw image data not being persistent leading to a variety of issues when copying image information.

Make recipes for real targets should not list phony order-only dependencies

Well, I learned something new today. This goes back to some code I wrote months back. Code that was criticised for an issue, which I ignored.

$(OBJS): $(OBJDIR)/%.o : $(SRCDIR)/%.cpp $(DEPDIR)/%.d | build-folder

nas2d-core/makefile

Lines 43 to 46 in 8187250

.PHONY:build-folder
build-folder:
@mkdir -p $(patsubst $(SRCDIR)/%,$(OBJDIR)/%, $(FOLDERS))
@mkdir -p $(patsubst $(SRCDIR)/%,$(DEPDIR)/%, $(FOLDERS))

A phony target has no output, and so can never be up-to-date. As such, the rule will always run when building a real target.

In this case, the rule doesn't need to be phony, since the created directory is a real output. The only thing invalid about it is the date, hence why it's an order-only dependency.

The rule should be updated so the object file has an order-only dependency on the directory, and the directory (rather than a phony rule) should be the target of the build rule to create it.

That should eliminate needless attempts to create already existing folders during a build.

Update Music's interface to eliminate references to SDL

As with other sections of the code, I want to update Music to eliminate public references to SDL and SDL_Mixer. This can be done easily by using void* pointers and then casting to the correct type in the Mixer itself. This allows future updates to replace the back end without having to expose the user to the implementation details and allows us to remove includes from Music's public interface that aren't necessary.

Implement an XML Wrapper Class to hide TinyXML Implementation

TinyXML is a great library and I see no need to change it, however TinyXML's interface doesn't need to be exposed in the public NASD interface.

Justification

I tend to not really care much for the pImpl idiom in open-source projects as it needlessly complicates maintenance (with the benefit of improved compile times and cleaner interfaces with less implementation details that end users don't care about), but in this case it makes perfect sense. It would allow us to switch to a different XML library or even implement our own without the user ever having to recompile all of their code, simply relink.

Requirements

The XML used in NAS2D is fairly simplistic. All definitions almost exclusively use tag attributes instead of tag content and on occasion uses comments.

Any interface will need to provide the user with the ability to add tags, attach attributes to those tags and also provide content for those tags as well as quickly and easily find tags and interpret attributes.

Add center_x/center_y functions to Font

In keeping things cohesive across the entire interface, center_x()/center_y() functions should be added to the Font class. This eliminates the need for code such as:

Font fnt("some_font.ttf", 14);
Utility<Renderer>::get().drawText(fnt, "Some Text", (fnt.width("Some Text") / 2) + 100, (fnt.height() / 2) + 100, 255, 255, 255);

This basically centers the font around a point and is a surprisingly common function, much like Rectangle's and the screen itself. The above code with the improvements will look as such:

Font fnt("some_font.ttf", 14);
Utility<Renderer>::get().drawText(fnt, "Some Text", fnt.center_x("Some Text") + 100, fnt.center_y() + 100, 255, 255, 255);

This is mostly a readability improvement and a convenience function.

Rename drawPixel to drawPoint

Title says it all.

JUSTIFICATION

drawPixel() is fairly simple to understand but drawPoint() better conforms with the naming of the other primitives functions such as drawLine() and drawBox().

Remove Random Class

Pull all references to the Random and MersenneTwister classes from all NAS2D source code.

Upgrade PhysFS to version 3.0.1

PhysFS version 3.0.1 has a bunch of new handy functions. In particular setSaneConfig allows for easy cross platform setup of sensible read and write directories.

The setSaneConfig function should also nicely handles write folders when a user isn't an administrator on Windows. I'm not sure if the current code handles that well, or if it requires certain Windows features, namely UAC Virtualization, which automatically redirects writes to "Program Files" to a user specific directory.

The setSaneConfig(oraganization, appName, archiveExt, includeCdRoms, archivesFirst) method is implemented in terms of:

It is capable of automatically creating the write folder. The default write folder is getPrefDir. The default read path includes both getPrefDir and getBaseDir.


To use the newer getPrefDir(organization, appName) or setSaneConfig(organization, appName, ...) methods, we will need additional parameters passed into the library and fed to the filesystem initialization code. This will impact the parameter lists of both Game::Game, and Filesystem::init. Currently the methods are defined as:

Game::Game(const std::string& title, const std::string& argv_0, const std::string& configPath, const std::string& dataPath)
void Filesystem::init(const std::string& argv_0, const std::string& startPath)

The title could perhaps serve as the app name for Game, though would need to be added to Filesystem::init. An organization name would need to be added to both parameter lists.

This should also allow removing of the hardcoded .lom path component in the Linux build. Additionally, the dataPath/startPath parameter is currently not used on Linux, which instead has a hardcoded "data" path component.

Remove Exception Class

Remove the Exception class and all references to it (see issue #13).


From Issue #13

In an effort to reduce unnecessary code and to conform with modern C++ standards, the Exception class should be deprecated in favor of using exception classes derived from std::runtime_exception. This will provide a much cleaner interface, allows the rest of the library to throw specific exception types where applicable and set exception messages using a standard interface.

Add draw calls unaffected by fade

Title says it all. Currently everything that is drawn is affected by the fade effects. Would like to have the option to draw some images (like a mouse pointer) that isn't affected by fades.


This will require a few modifications, none of which should break existing code.

Adding a boolean parameter to all image drawing functions

At the end of each draw image function, a boolean flag, "ignore_fade", or something to that effect should be added with a default flag of 'false'. This way all existing code can continue to use the function without having to make changes.

Internal Changes

Internally this the Renderer handles fades by drawing a rectangle over the screen and adjusting its alpha parameter. In order to make this work, images that will ignore the fade effect need to be drawn above this rectangle.

Simplest way is to 'defer' drawing these images until after the fade rectangle is added. A list with position, color and image pointer should suffice.

Issues to Consider

Simplest method is to use a std::vector and simply '.clear()' it after ever frame. E.g., at the end of the frame draw the rectangle, iterate through the list of deferred drawing, clear the list, rinse repeat.\

This can lead to several issues:

  1. Performance Issues - doing this on a lot of Image's can be time consuming and costly for the renderer. Use of the image blitter in this way should be limited.
  2. Unexpected Draw Order - if a user attempts to use this form of the blitter, the Image will be drawn above everything else regardless of when the call was made.

Alternatives

The current method of fade effects is adequate. However, it's possible that using a global illumination source would provide an easier alternative. Apply a directional light to everything as you render it and turn off lighting when you want to avoid fades.

This would require a fundamental change to the Renderer interface but is a viable alternative.

Add a music finished playing callback

Currently the only method for determining whether or not music is playing is to poll Mixer using musicPlaying. This works but it's not consistent with the callback hook method I've been pushing in NAS2D like the EventHandler and the way Sprite can notify an observer that a particular animation has finished playing.

Would like to add a callback method to Mixer so that observers can connect themselves to music complete events.

Deprecate Random Class

Before the C++11 standards, we used the Random class which used a Mersenne Twister implementation to generate random numbers. The two classes are a little kludgy with the MT implementation lifted out of public domain code.

With a push toward cleaner, more modern code and not reinventing the wheel, we want to encourage users of NAS2D to take advantage of C++ standard libraries vs. rolling our own.


To be removed by v1.4.0

Build an ImageRectangle graphics primitive.

Currently the Renderer has a function to draw rectangles that are textured. While this works it's really not the job of the Renderer to perform this function. Additionally, the current implementation requires references to individual image parts (basically 9 separate images) and is extremely inefficient.

That is where the ImageRectangle comes in. This class will replace the image rect function from the Renderer class.

Related Tasks

Task #36
Task #38

Add Fade callbacks to Renderer

As with the other issue I opened for Mixer, I'd like to add fade in and fade out callback's to the Renderer so the user doesn't need to poll the renderer with functions like Renderer::isFading() and Renderer::isFaded(). This will be more consistent with the observer pattern that's been pushed with the EventHandler and other systems in NAS2D.

Should calls to copy assignment operator throw an exception?

Calls to copy an object to itself should be considered a serious mistake. While the program can continue merrily along without blowing up, I'm thinking we should throw some sort of exception to let the user know they have a mistake in their code.

Assuming that we go that route, we need to think of a good name for the exception. Since it can happen in any of the resources only one exception needs to be created for this.

I'm thinking something like self_copy_assignment.

WindowResized events may notify Renderer last

There are cases where the Renderer is not the first listener for window resized events to be notified. This causes an issue with some programs that rely on the Renderer for width/height.

While not technically a bug this is very much a usability issue that has caused confusion for me and absolutely would cause confusion for users.


Solution here is to find a way to force the Renderer to get its resize event notification first -- how to do that is a bit more complicated as the Delegate class that is used in the Sigs/Slots implementation uses std::set which doesn't maintain insertion order.

Two options are available here: Modify the Delegate classes to use std::vector instead of std::set and perform a manual check for duplicates (more time consuming to develop but a fairly clean solution) or have the EventHandler explicitly push a resized event to the Renderer before anything else (a lot easier and faster but will result in duplicate events being received by the client application and is a true kludge).

Update calls to deprecated PhysFS functions

A number of PhysFS functions have been deprecated, with suggested alternatives:

Some of these calls could be updated using the current older version of PhysFS. This would reduce the warnings when using a newer library version, while still maintaining compatibility with the older version. Other updates may be part of an upgrade effort that breaks PhysFS version compatibility (such as getPrefDir and setSaneConfig).

Add a function to set a window icon

Currently the window doesn't use any sort of window icon so the default Windows icon is used instead.

This function should be in the Renderer interface and specify a file path. The function handles the specifics of loading the file and adding it to the window.

Renderer:window_icon(const std::string& path);

Refactor KeyTranslator object

The current object uses a switch/case statement and is brutally inefficient. I'd like to reimplement this using a table/dictionary approach. It's much cleaner, much easier to maintain and should be orders of magnitude faster (red/black trees are generally faster than if/then/else chains).

Add drawSubImageRepeated to Renderer

The Renderer interface currently provides drawImageRepeated(). This version will perform the same function as drawImageRepeated() but will use a sub image instead of the entire image.

Update Sound's interface to eliminate references to SDL

As with other sections of the code, Sound's interface can be improved by changing pointers of SDL_Mixer types to void* pointer types. These can then be cast to the appropriate type in the Mixer.

This eliminates the need to expose implementation details to the end user and improves code readability by removing unnecessary includes in the public interface.

Modify Renderer Interface to maintain color draw state

Currently the renderer interface is set up such that every call to the renderer asks the user to provide color information. Each function provides default values for these colors.

While this makes it very easy to set up rendering parameters for tinting images and primitives for drawing, it unfortunately also adds to the complexity of the overall interface. The even more serious problem is in the OpenGL implementation which now makes a call to glColor4ub for every single draw call. Since almost everything is drawn using the values { 255, 255, 255, 255 } this leads to a LOT of overhead and wasted time.


Changes

Instead, the Renderer should store state information about both the clear color and the draw color. If the user wants to change the draw color, they will need to explicitly set them. The following functions should be added to the Renderer interface:

This will represent an interface breaking change (again) but most legacy code should be easily adapted.

Additions

void clearColor(int r, int g, int b);
void resetClearColor(); // sets clear color to black { 0, 0, 0 }
void drawColor(int r, int g, int b, int a);
void resetDrawColor(); // sets draw color to white { 255, 255, 255, 255 }

Removal

All color information from all draw calls (e.g., drawImage, drawText, drawLine, etc.) can be removed from from function prototypes. This will be a fundamental change regarding how draw functions are used.

Justifications

My initial thinking was to simply have each function test the current draw color against what was specified and make changes accordingly but this would further bloat overhead.

While forcing the user to explicitly set color states is annoying and not the cleanest look, profiling in 'gDEBugger' shows that it would eliminate tens of thousands of completely superfluous OpenGL state changes that effectively do nothing. While performance changes may not be immediately obvious to the end user, the reduced overhead would be significant and would also force the user to think about how to group draw calls to to avoid making too many state changes.

Remove letterbox mode from Renderer

I added the letterbox mode a long, long time ago when I thought it could be a useful feature but ultimately it just needlessly clutters the Renderer interface.

Pull this function from the Renderer and remove all reference to it.

Add init check to Filesystem

Currently most of the utility objects can be called whenever however some rely on the Filesystem to be fully initialized.

As of now the way it's set up if the Filesystem is not initialized properly all of the calls will silently fail or will perhaps spit out an error message to std::cout.

Since filesystem operations aren't performed every frame and are already expected to take a little time, it would be prudent to add an initialized flag to the Filesystem that is checked by all functions. If this flag is not set the Filesystem should throw an exception stating that the Filesystem hasn't been properly initialized.

EventHandler::warpMouse() doesn't raise a mouse motion event

This is a basic oversight but it results in incorrect behavior. When the warpMouse() function is called, no event for a mouse position (mouse motion) event is raised.

To get correct behavior, when this function is called the EventHandler should raise a Mouse Motion event with the current coordinates and a { 0, 0 } relative coordinate change.

Add center_x/center_y functions to Image

In keeping things cohesive across the entire interface, center_x()/center_y() functions should be added to the Image class. This eliminates the need for code such as:

Image i("some_image.png");
Utility<Renderer>::get().drawImage(i, (i.width() / 2) + 100, (i.height() / 2) + 100);

This basically centers the image around a point and is a surprisingly common function, much like Rectangle's and the screen itself. The above code with the improvements will look as such:

Image i("some_image.png");
Utility<Renderer>::get().drawImage(i, i.center_x() + 100, i.center_x() + 100);

This is mostly a readability improvement and a convenience function.

Leaky Headers

The NAS2D headers leak third party includes (OpenGL) in exactly one file: ShaderManager

Should this be allowed, or should users of NAS2D be isolated from the underlying implementation (OpenGL, SDL, etc.). Personally, I think third party includes should stay out of public header files whenever possible. The one exception being when two libraries are meant to be used together in tandem by the client code, which does not appear to be the case here.

Further, ShaderManager is currently dead code. The header is not included by the main NAS2D header, nor is any of it's code referenced from other parts of the project. I think ShaderManager, and the recently commented out Shader, should be deleted from the current version.

Going forward, I'd suggest keeping third party includes out of public headers as a rule.

Add keep_resident flag to Image for raw pixel data

Currently, if we load another copy of an Image that's already available in the Renderer's texture list, all the basic data is copied to the new Image but the raw pixel data is not.

I modified the code for a usage edge case I ran into while using NAS2D for another project. The raw pixel data is now loaded regardless of whether or not the texture has already been created.

This solves the immediate problem in the project that ran into this issue (using pixelColor()) but is not ideal for regular use as it's a lot slower for load times and it's also very memory inefficient.

I want to modify the Image class to take a boolean value, keep_resident or stay_resident or something along those lines that instructs an Image to load a copy of the raw pixel data. 99% of uses of Image won't need this functionality so this will improve memory efficiency.

The modification should be done through a bool value in the Image c'tors. A default value should be provided so that current use doesn't break when updating NAS2D.

Add Text Input/Editing to EventHandler

The EventHandler currently has no notion of text input. This required a KeyTranslator object that would take basic keyboard events and translate them into ASCII characters.

SDL2.0 introduced text editing/input events that handle this far better than the KeyTranslator. It stands to reason then that EventHandler should adopt similar functionality.

Implementation Details

The EventHandler will need to add functions to enable and disable text input/editing and poll the current input editing state:

void EventHandler::textInputMode(bool); // true to turn on, false to turn off.
bool EventHandler::textInputMode(); // Queries the input state

Event signal:

NAS2D::Signals::Signal1<std::string> TextInputEventCallback;

Potential for Defects

The option to use a std::string by value vs. by reference here is intended to prevent inevitable mistakes. While passing by reference would work normally for typical uses (by the time the local string object is destroyed the signal observer will have already copied the string) and would certainly be more efficient, there will be times when someone will attempt to maintain a reference to the std::string either as a reference or as a pointer. In these cases the application will eventually segfault because as soon as the Signal1<std::string&>::Emit() function returns the memory for the std::stringwill be automatically deallocated resulting in dangling pointers/references.

While this is generally inefficient due to the number of c'tors and copy operations, it ensures correct behavior. Additionally, reasonably good optimizing compilers can eliminate a lot of the overhead in release builds.

Add Window Resize events

This is a two part task -- the Event Handler should respond to window resize events and push those out to listeners so that they can adjust whatever they need to.

The second part is that the Renderer classes should be able to dynamically respond to these events including switching back and forth between Windowed and Fullscreen modes (see #28).

Hide implementation details in Font

As with the Image, Music and Sound resource classes, Font exposes a lot of its implementation details. All of this can be hidden from the interface declarations by simply moving the static members into the Font.cpp file and making it part of that module.

Move MouseButton enumeration into EventHandler

The current MouseButton enumeration is in the file Event/MouseButton.h. This would be more appropriate in the EventHandler class itself.

NOTE
This will be interface breaking as scope resolution will need to change from NAS2D:: to NAS2D::EventHandler::.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.