Created
November 16, 2011 14:58
-
-
Save iwadon/1370251 to your computer and use it in GitHub Desktop.
「白い弾幕くん」をMac OS X 10.7.2 + SDL 1.3でビルドしたら落ちるのでとりあえず手を加えてみた。
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
| diff --git a/src/mysdl_padinput.h b/src/mysdl_padinput.h | |
| index 630139f..dd52ada 100644 | |
| --- a/src/mysdl_padinput.h | |
| +++ b/src/mysdl_padinput.h | |
| @@ -145,7 +145,7 @@ namespace MSDL { | |
| class KeyButtonInput : public ButtonInput { | |
| public: | |
| KeyButtonInput(SDLKey key) : key_(key) {} | |
| - virtual bool getButton() { return SDL_GetKeyState(0)[key_]; } | |
| + virtual bool getButton() { return SDL_GetKeyboardState(NULL)[SDL_GetScancodeFromKey(key_)]; } | |
| virtual std::string getName() const; | |
| diff --git a/src/surface.cc b/src/surface.cc | |
| index 530884e..f17428a 100644 | |
| --- a/src/surface.cc | |
| +++ b/src/surface.cc | |
| @@ -137,7 +137,9 @@ void Surface::setMask(Color col) { | |
| for (int x = 0; x < surf_->w; x++) { | |
| for (int y = 0; y < surf_->h; y++) { | |
| Uint32 pixel = getPixel(x, y); | |
| - if (pixel != surf_->format->colorkey) { | |
| + Uint32 colorkey; | |
| + SDL_GetColorKey(surf_, &colorkey); | |
| + if (pixel != colorkey) { | |
| Color before = getRGB(pixel); | |
| Color after(static_cast<int>(before.r()*rmask), | |
| static_cast<int>(before.g()*gmask), | |
| diff --git a/src/util/loadconf.h b/src/util/loadconf.h | |
| index b2c8c20..3de8a6a 100644 | |
| --- a/src/util/loadconf.h | |
| +++ b/src/util/loadconf.h | |
| @@ -80,11 +80,11 @@ void ConfMapGenerater::generate(std::istream& is, Map_& map) { | |
| while (is.getline(ln, MAXBUF)) { | |
| std::string line(ln); | |
| - unsigned int s; | |
| + std::string::size_type s; | |
| // コメントの除去 | |
| if ((s = line.find("#")) != std::string::npos) | |
| - line.erase(s); | |
| + line.erase(s, line.size() - s); | |
| // 行頭空白の除去 | |
| if (!line.empty() && line[0] == ' ') | |
| diff --git a/src/util/util.cc b/src/util/util.cc | |
| index b9a97f1..93eff3a 100644 | |
| --- a/src/util/util.cc | |
| +++ b/src/util/util.cc | |
| @@ -17,11 +17,11 @@ const Color Color::BLUE ( 0, 0, 255); | |
| const Color Color::PURPLE(255, 0, 255); | |
| void ignoreBrankAndComment(std::string& str, std::string delim) { | |
| - unsigned int s; | |
| + std::string::size_type s; | |
| // コメントの除去 | |
| if ((s = str.find(delim)) != std::string::npos) | |
| - str.erase(s); | |
| + str.erase(s, str.size() - s); | |
| // 行頭空白の除去 | |
| if (!str.empty() && str[0] == ' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment