Made some progress on the refactoring but I need to start getting serious and not reworking this code to death.
This commit is contained in:
parent
6ed57cd4a8
commit
51c1e04f61
5 changed files with 46 additions and 33 deletions
11
main.cpp
11
main.cpp
|
@ -31,10 +31,10 @@ void draw_gui(sf::RenderWindow &window, sf::Text &text, Stats &stats) {
|
|||
window.draw(text);
|
||||
}
|
||||
|
||||
void draw_weapon(sf::RenderWindow &window, sf::Sprite *weapon, float rotation) {
|
||||
weapon->setPosition({SCREEN_WIDTH/2,SCREEN_HEIGHT/2});
|
||||
weapon->setRotation(sf::degrees(rotation));
|
||||
window.draw(*weapon);
|
||||
void draw_weapon(sf::RenderWindow &window, sf::Sprite &weapon, float rotation) {
|
||||
weapon.setPosition({SCREEN_WIDTH/2,SCREEN_HEIGHT/2});
|
||||
weapon.setRotation(sf::degrees(rotation));
|
||||
window.draw(weapon);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
@ -74,8 +74,9 @@ int main() {
|
|||
auto elapsed = std::chrono::duration<double>(end - start);
|
||||
stats.sample(1/elapsed.count());
|
||||
|
||||
auto weapon_sprite_ptr = rayview.$textures.sword.sprite;
|
||||
draw_gui(window, text, stats);
|
||||
draw_weapon(window, rayview.$textures.sword.sprite, rotation);
|
||||
draw_weapon(window, *weapon_sprite_ptr, rotation);
|
||||
window.display();
|
||||
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::W)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue