Skip to content

Commit

Permalink
apply clang tidy
Browse files Browse the repository at this point in the history
add run clang_format script
update readme
  • Loading branch information
Madour committed May 1, 2024
1 parent d84dbb1 commit 7d48d95
Show file tree
Hide file tree
Showing 4 changed files with 434 additions and 8 deletions.
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,25 +121,45 @@ API documentation can be found on the [**wiki**](https://github.com/Madour/LDtkL
### Demo

> [!WARNING]
> The demos below are probably using an older version of the library.
> The demos below might be using an older version of the library.
A demo using LDtkLoader with SFML can be found [**here**](https://github.com/Madour/LDtk-SFML-Game).

Here is a preview :

https://user-images.githubusercontent.com/11854124/122610077-57f48a00-d07f-11eb-98ac-278a3d3dbd01.mp4

---
---

A demo using LDtkLoader with Direct X11 can be found [**here**](https://github.com/dontpanic5/LDtk-D11/) (by @dontpanic5)

Here is a preview :
Here is a preview :

https://user-images.githubusercontent.com/242570/129111903-88727f39-9e21-45cb-bc76-a5d7975a4a9c.mp4

### To Do
- [ ] Helper classes/methods for SFML or SDL rendering

### Contributing

Contributions are welcome.

If you have LLVM tools installed, run clang-format to make sure your code respects the project's code style:
```
python tools/run_clang_format.py -r src include
```

To apply the format changes, run:
```
python tools/run_clang_format.py -i -r src include
```

Optionaly, you can also run clang-tidy to make sure there are no coding mistakes or code smells
(although, some warnings can be ignored):
```
clang-tidy --config-file=.clang-tidy src/*.cpp -- -I include -I build/include
```

### License

LDtkLoader is licensed under the **zlib license**.
Expand Down
4 changes: 1 addition & 3 deletions src/FieldsContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ void FieldsContainer::parseArrayField(
});
}
auto& this_field = addArrayField(name, values);
// auto& this_field = *dynamic_cast<ArrayField<EntityRef>*>(m_array_fields.at(name));
for (auto& ent_ref : this_field) {
temporary_entity_refs_array.emplace_back(&ent_ref.value());
}
Expand Down Expand Up @@ -167,14 +166,13 @@ void FieldsContainer::parseValueField(
addField<EntityRef>(name, null);
}
else {
addField<EntityRef>(
auto& this_field = addField<EntityRef>(
name,
{IID(field["entityIid"].get<std::string>()),
IID(field["layerIid"].get<std::string>()),
IID(field["levelIid"].get<std::string>()),
IID(field["worldIid"].get<std::string>())}
);
auto& this_field = *dynamic_cast<Field<EntityRef>*>(m_fields.at(name));
temporary_entity_refs_array.emplace_back(&this_field.value());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ auto Tile::getVertices() const -> std::array<Vertex, 4>

// set vertices texture coordinates
for (size_t i = 0; i < verts.size(); ++i) {
verts[i].tex.x = tex_rect.x + tex_coo[i].x + modif[i].x;
verts[i].tex.y = tex_rect.y + tex_coo[i].y + modif[i].y;
verts[i].tex.x = tex_rect.x + tex_coo.at(i).x + modif.at(i).x;
verts[i].tex.y = tex_rect.y + tex_coo.at(i).y + modif.at(i).y;
}
// clang-format on

Expand Down
Loading

0 comments on commit 7d48d95

Please sign in to comment.