Some minor cosmetic code changes.

This commit is contained in:
Leon Styhre 2020-08-30 22:25:38 +02:00
parent d512c2b11d
commit 9da16dd00e
7 changed files with 7 additions and 8 deletions

View file

@ -39,7 +39,7 @@ https://google.github.io/styleguide/cppguide.html
* Use K&R placements of braces, read the Linux Kernel coding style document for clarifications * Use K&R placements of braces, read the Linux Kernel coding style document for clarifications
* Always use spaces between keywords and opening brackets, i.e. `if ()`, `for ()`, `while ()` etc. * Always use spaces between keywords and opening brackets, i.e. `if ()`, `for ()`, `while ()` etc.
* Indentation of switch/case statements is optional, but it's usually easier to read the code with indentations in place * Indentation of switch/case statements is optional, but it's usually easier to read the code with indentations in place
* Use `std::string` instead of `char *` or `char []` unless there is a specific reason requiring the latter * Use `std::string` or `std::vector<char>` instead of `char *` or `char []` unless there is a specific reason requiring the latter
* Actually, try to use C++ syntax in general instead of C syntax, another example would be `static_cast<int>(someFloatVariable)` instead of `(int)someFloatVariable` * Actually, try to use C++ syntax in general instead of C syntax, another example would be `static_cast<int>(someFloatVariable)` instead of `(int)someFloatVariable`
* If the arguments (and initializer list) for a function or class exceeds 4 items, arrange them vertically to make the code easier to read * If the arguments (and initializer list) for a function or class exceeds 4 items, arrange them vertically to make the code easier to read
* Always declare one variable per line, never combine multiple declarations of the same type * Always declare one variable per line, never combine multiple declarations of the same type

View file

@ -216,7 +216,7 @@ bool SystemData::loadConfig()
std::string path = getConfigPath(false); std::string path = getConfigPath(false);
const std::string rompath = FileData::getROMDirectory(); const std::string rompath = FileData::getROMDirectory();
LOG(LogInfo) << "Loading system config file " << path << "..."; LOG(LogInfo) << "Loading system configuration file " << path << "...";
if (!Utils::FileSystem::exists(path)) { if (!Utils::FileSystem::exists(path)) {
LOG(LogWarning) << "es_systems.cfg does not exist."; LOG(LogWarning) << "es_systems.cfg does not exist.";

View file

@ -467,7 +467,7 @@ int main(int argc, char* argv[])
SDL_Event event; SDL_Event event;
if (!window.init()) { if (!window.init()) {
LOG(LogError) << "Window failed to initialize!"; LOG(LogError) << "Window failed to initialize.";
return 1; return 1;
} }

View file

@ -83,7 +83,7 @@ GuiComponent* Window::peekGui()
bool Window::init() bool Window::init()
{ {
if (!Renderer::init()) { if (!Renderer::init()) {
LOG(LogError) << "Renderer failed to initialize!"; LOG(LogError) << "Renderer failed to initialize.";
return false; return false;
} }

View file

@ -97,8 +97,7 @@ void ButtonComponent::render(const Transform4x4f& parentTrans)
mBox.render(trans); mBox.render(trans);
if (mTextCache) if (mTextCache) {
{
Vector3f centerOffset((mSize.x() - mTextCache->metrics.size.x()) / 2, Vector3f centerOffset((mSize.x() - mTextCache->metrics.size.x()) / 2,
(mSize.y() - mTextCache->metrics.size.y()) / 2, 0); (mSize.y() - mTextCache->metrics.size.y()) / 2, 0);
trans = trans.translate(centerOffset); trans = trans.translate(centerOffset);

View file

@ -155,7 +155,7 @@ void ImageGridComponent<T>::add(const std::string& name, const std::string& imag
entry.object = obj; entry.object = obj;
entry.data.texturePath = imagePath; entry.data.texturePath = imagePath;
static_cast<IList< ImageGridData, T >*>(this)->add(entry); static_cast<IList<ImageGridData, T>*>(this)->add(entry);
mEntriesDirty = true; mEntriesDirty = true;
} }

View file

@ -373,7 +373,7 @@ void TextListComponent<T>::add(const std::string& name, const T& obj, unsigned i
entry.name = name; entry.name = name;
entry.object = obj; entry.object = obj;
entry.data.colorId = color; entry.data.colorId = color;
static_cast<IList< TextListData, T >*>(this)->add(entry); static_cast<IList<TextListData, T>*>(this)->add(entry);
} }
template <typename T> template <typename T>