This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Game::Game() : player(createPlayer()) {} | |
| Game::~Game() {} | |
| Sprite Game::createPlayer() | |
| { | |
| if (images.get("imageKey") == nullptr) { | |
| images.load("imageKey", "imageFilename.png"); | |
| } | |
| Sprite temp(images.get("imageKey")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #0 std::string::compare(std::string const&) const() at /usr/lib/libstdc++.so.6:-1 | |
| #1 std::operator< <char, std::char_traits<char>, std::allocator<char> >() at /usr/include/c++/4.7.2/bits/basic_string.h:2566 | |
| #2 std::less<std::string>::operator()() at /usr/include/c++/4.7.2/bits/stl_function.h:236 | |
| #3 std::_Rb_tree<std::string, std::pair<std::string const, SDL_Texture*>, std::_Select1st<std::pair<std::string const, SDL_Texture*> >, std::less<std::string>, std::allocator<std::pair<std::string const, SDL_Texture*> > >::_M_lower_bound() at /usr/include/c++/4.7.2/bits/stl_tree.h:1097 | |
| #4 std::_Rb_tree<std::string, std::pair<std::string const, SDL_Texture*>, std::_Select1st<std::pair<std::string const, SDL_Texture*> >, std::less<std::string>, std::allocator<std::pair<std::string const, SDL_Texture*> > >::find() at /usr/include/c++/4.7.2/bits/stl_tree.h:1543 | |
| #5 std::map<std::string, SDL_Texture*, std::less<std::string>, std::allocator<std::pair<std::string const, SDL_Texture*> > >::find() at /usr/include/c++/4.7.2/bits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Update all enemies, removing them if dead | |
| enemies.erase( | |
| std::remove_if( | |
| enemies.begin(), | |
| enemies.end(), | |
| [&] (Sprite& enemy) -> bool { | |
| enemy.update(dt); | |
| // Kill if off screen | |
| if (enemy.pos.x < 0) { | |
| enemy.alive = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://www.sfml-dev.org/tutorials/2.0/ | |
| https://github.com/eXpl0it3r/SmallGameEngine | |
| http://www.bromeon.ch/libraries/thor/tutorials.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SFML/Graphics.hpp> | |
| #include <Thor/Events.hpp> | |
| #include <string> | |
| #include <functional> | |
| int main(int argc, char* argv[]) | |
| { | |
| // The SFML Window | |
| sf::RenderWindow mainWindow(sf::VideoMode(800, 600), "Thor Actions"); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected override void Update(GameTime gameTime) | |
| { | |
| // Allows the game to exit | |
| if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) | |
| this.Exit(); | |
| paddle.Update(); | |
| foreach (Ball ball in balls) { | |
| ball.Update(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @brief Moves spaceship left/right. | |
| */ | |
| void Base::joy_axis(SDL_JoyAxisEvent *joy) | |
| { | |
| if (joy->which == 0 && joy->axis == 0) { | |
| auto spaceship = &objects.at(1); | |
| int stick_pos = joy->value; | |
| float stick_mod = abs(stick_pos / 5000.0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Bind up arrow to FinchController.moveUp() | |
| mainPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("UP"), "moveUp"); | |
| mainPanel.getActionMap().put("moveUp", new AbstractAction() { | |
| @Override | |
| public void actionPerformed(ActionEvent e) { | |
| if (!isMoving[0]) { | |
| SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { | |
| @Override | |
| protected Void doInBackground() throws Exception { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mainPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("UP"), "moveUp"); | |
| mainPanel.getActionMap().put("moveUp", new AbstractAction() { | |
| @Override | |
| public void actionPerformed(ActionEvent e) { | |
| javax.swing.SwingUtilities.invokeLater(new Runnable() { | |
| @Override | |
| public void run() { | |
| bot.moveUp(); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdlib.h> | |
| #include <cstdlib> | |
| #include <iostream> | |
| #include <fstream> | |
| #include <string> | |
| #include <vector> | |
| using namespace std; | |
| struct profile |