opentomb / OpenTomb

An open-source Tomb Raider 1-5 engine remake
http://opentomb.github.io/
GNU Lesser General Public License v3.0
1.38k stars 143 forks source link

Ideas for future refactorings #118

Open stohrendorf opened 9 years ago

stohrendorf commented 9 years ago

Everything related to refactoring ideas (more OOP/pure C++, splitting headers, changing code organization, etc.) should go here. No bugs, only ideas for future and a possible need for discussion here.

stohrendorf commented 9 years ago

Possibly related: #119

Lwmte commented 9 years ago

Not strictly an idea about refactoring, but something related... Make all GUI elements classes derived from "widget" base class. I have in mind making stack-based GUI system (e.g., if you have one menu opened, and second is opened, first is rendered, but focus is shifted to second, etc. - here is the link to article describing this approach: http://rivermanmedia.com/object-oriented-game-programming-the-gui-stack/), and for this system I want to make all GUI elements widgets.

Basically, widget can have all alignment properties already implemented for bars, plus some extra fields, as tab index, horizontal/vertical index (to quickly navigate through elements with directional keys), ability to gain focus, and maybe some more... I have no experience in programming GUIs, maybe you have better idea how base GUI widget class should look like!

stohrendorf commented 9 years ago

I've written a basic widget/GUI system once, though without event handling yet and with special needs to the layout, but that should be easy to adopt: http://sourceforge.net/p/peepeeplayer/code/ci/master/tree/src/ppg/widget.h https://github.com/stohrendorf/ppplay/blob/master/src/ppg/widget.h

TeslaRus commented 9 years ago

I have idea how to complete remove sticks for colored polygons: add manually white texture to the atlas (4x4 or 8x8) as a first unique texture and use special atlas function to assign white texture coordinates for polygons in tr_setupColoredFace(...);