翻蚳è ããïŒãã®èšäºã¯ãå ¬åŒã®SFMLã©ã€ãã©ãªã¬ã€ãã®ç¿»èš³ãµã€ã¯ã«ã®2çªç®ã§ãã éå»ã®èšäºã¯ãã¡ãã«ãããŸãã ãã®äžé£ã®èšäºã®ç®çã¯ãå ã®èšèªãç¥ããªã人ã«ãã®ã©ã€ãã©ãªã«æ £ããæ©äŒãæäŸããããšã§ãã SFMLã¯ãã·ã³ãã«ã§ã¯ãã¹ãã©ãããã©ãŒã ã®ãã«ãã¡ãã£ã¢ã©ã€ãã©ãªã§ãã SFMLã¯ãã²ãŒã ããã®ä»ã®ãã«ãã¡ãã£ã¢ã¢ããªã±ãŒã·ã§ã³ãéçºããããã®ã·ã³ãã«ãªã€ã³ã¿ãŒãã§ã€ã¹ãæäŸããŸãã å ã®èšäºã¯ãã¡ãã«ãããŸã ã å§ããŸãããã
ç®æ¬¡ïŒ
0.1ã¯ããã«
1.ã¯ããã«
2.ã·ã¹ãã ã¢ãžã¥ãŒã«
3.ãŠã£ã³ããŠã¢ãžã¥ãŒã«
4.ã°ã©ãã£ãã¯ã¢ãžã¥ãŒã«
5.ãªãŒãã£ãªã¢ãžã¥ãŒã«
6.ãããã¯ãŒã¯ã¢ãžã¥ãŒã«
1.ã¯ããã«
- SFMLãšVisual Studio
- SFMLãšã³ãŒã::ãããã¯ïŒMinGWïŒ
- SFMLããã³Linux
- SFMLãšXcodeïŒMac OS XïŒ
- CMakeã§SFMLãã³ã³ãã€ã«ãã
2.ã·ã¹ãã ã¢ãžã¥ãŒã«
3.ãŠã£ã³ããŠã¢ãžã¥ãŒã«
- ãŠã£ã³ããŠãéããŠç®¡çãã
- ã€ãã³ãåŠç
- ããŒããŒããããŠã¹ããžã§ã€ã¹ãã£ãã¯ã䜿çšãã
- OpenGLã䜿çšãã
4.ã°ã©ãã£ãã¯ã¢ãžã¥ãŒã«
- 2Dæç»ãªããžã§ã¯ã
- ã¹ãã©ã€ããšãã¯ã¹ãã£
- ããã¹ããšãã©ã³ã
- ãã©ãŒã
- é ç¹é åã䜿çšããŠç¬èªã®ãªããžã§ã¯ããèšèšãã
- äœçœ®ãå転ãã¹ã±ãŒã«ïŒãªããžã§ã¯ãã®å€æ
- ã·ã§ãŒããŒã§ç¹æ®å¹æãè¿œå ãã
- 2Dã«ã¡ã©ãšãã¥ãŒã³ã³ãããŒã«
5.ãªãŒãã£ãªã¢ãžã¥ãŒã«
- ãµãŠã³ããšé³æ¥œãåçãã
- ãªãŒãã£ãªé²é³
- ã«ã¹ã¿ã ãªãŒãã£ãªã¹ããªãŒã
- 空éåïŒ3DãµãŠã³ã
6.ãããã¯ãŒã¯ã¢ãžã¥ãŒã«
- ãœã±ããéä¿¡
- ããã±ãŒãžã®äœ¿çšãšæ¡åŒµ
- HTTPã䜿çšããWebèŠæ±
- FTPãã¡ã€ã«è»¢é
ãšã³ããªãŒ
ãã®èšäºã¯ãGCCã³ã³ãã€ã©ãŒã§Code :: Blockséçºç°å¢ã䜿çšããŠããå Žåã«èªãã¹ãæåã®èšäºã§ãïŒãã®éçºç°å¢ã®æšæºã³ã³ãã€ã©ãŒã§ãïŒã ãããžã§ã¯ãã®ã»ããã¢ããæ¹æ³ã説æããŸãã
SFMLãã€ã³ã¹ããŒã«ãã
æåã«ã ããŠã³ããŒãããŒãžããSFML SDKãããŠã³ããŒãããå¿ èŠããããŸã ã
äºãã«äºææ§ã®ãªãWindowsçšã®GCCãªãã·ã§ã³ãããã€ããããŸãïŒäŸå€åŠçãã¹ããªãŒã ã¢ãã«ãªã©ã®éãïŒã 䜿çšããŠããGCCã®ããŒãžã§ã³ã«äžèŽããããã±ãŒãžãéžæããŠãã ããã äžæãªå Žåã¯ãMinGW / binãã£ã¬ã¯ããªã«ååšãããã¡ã€ã«ïŒlibgcc_s_sjlj-1.dllãŸãã¯libgcc_s_dw2-1.dllïŒã確èªããŠãã ããã MinGWãCode :: Blocksã§ã€ã³ã¹ããŒã«ãããŠããå ŽåãããããSJLJããŒãžã§ã³ããããŸãã GCCã®ããŒãžã§ã³ãããªã³ã³ãã€ã«ãããããŒãžã§ã³ã®SFMLã©ã€ãã©ãªã§åäœããªãå Žåã SFMLãèªåã§ã³ã³ãã€ã«ããå¿ èŠããããŸã ã é£ãããããŸããã
次ã«ãSFMLã¢ãŒã«ã€ããèªåã«éœåã®è¯ããã£ã¬ã¯ããªã«è§£åããå¿ èŠããããŸãã ããããŒãã¡ã€ã«ãšã©ã€ãã©ãªãMinGWã€ã³ã¹ããŒã«ã«ã³ããŒããããšã¯ãå§ãããŸããã ç¹ã«åãã©ã€ãã©ãªã®è€æ°ã®ããŒãžã§ã³ãŸãã¯è€æ°ã®ã³ã³ãã€ã©ã䜿çšããå Žåã¯ãã©ã€ãã©ãªãå¥ã®å Žæã«ä¿ç®¡ããããšããå§ãããŸãã
SFMLãããžã§ã¯ãã®äœæãšèšå®
æåã«è¡ãå¿ èŠãããã®ã¯ãäœæãããããžã§ã¯ãã®ã¿ã€ããéžæããããšã§ãã ã³ãŒã::ãããã¯ã¯ãSFMLãããžã§ã¯ããå«ãå¹ åºããããžã§ã¯ãã¿ã€ããæäŸããŸãã 䜿çšããªãã§ãã ããïŒ ãã®ã¿ã€ãã®ãããžã§ã¯ãã¯ããªãé·ãéæŽæ°ãããŠããããSFMLã®ææ°ããŒãžã§ã³ãšäºææ§ããªãå¯èœæ§ããããŸãã 代ããã«ã空ã®ãããžã§ã¯ããäœæããŸãã ã³ã³ãœãŒã«ãåé€ããå Žåã¯ããããžã§ã¯ãããããã£ã®[ãã«ãã¿ãŒã²ãã]ã«ç§»åããã³ã³ãããã¯ã¹ã§[ã³ã³ãœãŒã«ã¢ããªã±ãŒã·ã§ã³]ã§ã¯ãªã[GUIã¢ããªã±ãŒã·ã§ã³]ãéžæããŸãã
次ã«ãããããŒãã¡ã€ã«ïŒæ¡åŒµåã.hppã®ãã¡ã€ã«ïŒãæ¢ãå Žæãã³ã³ãã€ã©ãŒã«ãSFMLã©ã€ãã©ãªïŒæ¡åŒµåã.libã®ãã¡ã€ã«ïŒãæ¢ããªã³ã«ãŒãæ瀺ããå¿ èŠããããŸãã
[ãã£ã¬ã¯ããªã®æ€çŽ¢]ã¿ãã®[ãã«ããªãã·ã§ã³]ã¿ãã«æ¬¡ãè¿œå ããŸãã
- ã³ã³ãã€ã©æ€çŽ¢ãã£ã¬ã¯ããªå ã®SFMLããããŒãã¡ã€ã«ãžã®ãã¹ ïŒ <install-SFMLãžã®ãã¹> / include ïŒ
- ãªã³ã«æ€çŽ¢ãã£ã¬ã¯ããªå ã®SFMLã©ã€ãã©ãªãžã®ãã¹ïŒ <install-SFMLãžã®ãã¹> / lib ïŒ
ãããã®ãã¹ã¯ãããã°æ§æãšãªãªãŒã¹æ§æã§åãã§ããããããããžã§ã¯ãã«å¯ŸããŠã°ããŒãã«ã«èšå®ã§ããŸãã
次ã®ã¹ãããã¯ãSFMLã©ã€ãã©ãªïŒæ¡åŒµåã.aã®ãã¡ã€ã«ïŒã䜿çšããŠã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããããšã§ãã SFMLã¯ã5ã€ã®ã¢ãžã¥ãŒã«ïŒã·ã¹ãã ããŠã£ã³ããŠãã°ã©ãã£ãã¯ã¹ããããã¯ãŒã¯ãããã³ãªãŒãã£ãªïŒãšããããã®ã©ã€ãã©ãªã§æ§æãããŠããŸãã ã©ã€ãã©ãªã¯ããããžã§ã¯ãã®ãã«ããªãã·ã§ã³ã®ãªã¹ãã®[ãªã³ã«ãŒèšå®]ã¿ãã«ãã[ãªã³ã¯ã©ã€ãã©ãª]ã«è¿œå ããå¿ èŠããããŸãã ãsfml-graphicsãããsfml-windowãããsfml-systemããªã©ãå¿ èŠãªãã¹ãŠã®SFMLã©ã€ãã©ãªãè¿œå ããŸãïŒãã¬ãã£ãã¯ã¹ãlibããšæ¡åŒµåã.aãã¯çç¥ããŠãã ããïŒã
èšå®ã«äžèŽããã©ã€ãã©ãªãæå®ããããšãéèŠã§ãïŒãããã°çšã®ãsfml-xxx-dãããã³ãªãªãŒã¹çšã®ãsfml-xxxããããããªããšãšã©ãŒãçºçããå¯èœæ§ããããŸãã
SFMLã©ã€ãã©ãªããªã³ã¯ãããšãã¯ãã©ã€ãã©ãªãæ£ããé åºã§ãªã³ã¯ããŠãã ãã;ããã¯GCCã«ãšã£ãŠéåžžã«éèŠã§ãã ã«ãŒã«ã¯ãä»ã®ã©ã€ãã©ãªã«äŸåããã©ã€ãã©ãªããªã¹ãã®æåã«é 眮ããããšã§ãã ãã¹ãŠã®SFMLã©ã€ãã©ãªã¯ãsfml-graphicsãsfml-windowãããã³sfml-systemã«äŸåããŠããŸãã ããã¯äžã®ã¹ã¯ãªãŒã³ã·ã§ããã«ç€ºãããŠããŸãã
äžèšã®èšå®ã䜿çšãããšãDLLãã¡ã€ã«ãå¿ èŠãšããSFMLã®åçããŒãžã§ã³ã䜿çšããŠãããžã§ã¯ãããã«ãã§ããŸãã åçã©ã€ãã©ãªã¬ã€ã¢ãŠãã䜿çšããã®ã§ã¯ãªããSFMLãå®è¡å¯èœãã¡ã€ã«ã«çŽæ¥çµ±åããå Žåã¯ãã©ã€ãã©ãªã®éçããŒãžã§ã³ããã«ãããå¿ èŠããããŸãã SFMLéçã©ã€ãã©ãªã®æ¥å°ŸèŸã¯ã-sãã§ãããããã°æ§æã®å Žåã¯ãsfml-xxx-sdãããªãªãŒã¹ã®å Žåã¯ãsfml-xxx-sãã§ãã
ãŸãããããžã§ã¯ãã®ããªããã»ããµãªãã·ã§ã³ã§SFML_STATICãã¯ããå®çŸ©ããå¿ èŠããããŸãã
éçãªã³ã¯ã®SFML 2.2以éã§ã¯ããã¹ãŠã®SFMLäŸåé¢ä¿ãæ§ç¯ããå¿ èŠããããŸãã ããã¯ãããšãã°ãsfml-window-sãŸãã¯sfml-window-sdããã«ãããå Žåãopengl32ãwinmmãããã³gdi32ããã«ãããå¿ èŠãããããšãæå³ããŸãã ãããã®ã©ã€ãã©ãªã®äžéšã¯ãæ¢ã«ãç¶æ¿å€ãã»ã¯ã·ã§ã³ã«ãªã¹ããããŠããå ŽåããããŸãããè¿œå ããŠãåé¡ã¯çºçããŸããã
次ã®è¡šã¯ãåã¢ãžã¥ãŒã«ã®äŸåé¢ä¿ã瀺ããŠããŸããSFMLãããã°ã©ã€ãã©ãªããã«ãããå Žåã¯ã-dãè¿œå ããŸãã
ã¢ãžã¥ãŒã« | äŸåé¢ä¿ |
---|---|
sfml-graphics-s
|
|
sfml-window-s
|
|
sfml-audio-s
|
|
sfml-network-s
|
|
sfml-system-s
|
|
ããã€ãã®SFMLã¢ãžã¥ãŒã«ã¯ä»ã®ã¢ãžã¥ãŒã«ã«äŸåããŠããå¯èœæ§ãããããšã«æ°ã¥ãããããããŸãããããšãã°ãsfml-graphics-sã¯sfml-window-sããã³sfml-system-sã«äŸåããŠããŸãã SFMLã©ã€ãã©ãªãéçã«æ§ç¯ããå Žåã¯ãäŸåé¢ä¿ãã§ãŒã³å ã®ãã¹ãŠã®äŸåé¢ä¿ãæºããããŠããããšã確èªããŠãã ããã äŸåé¢ä¿ã®1ã€ãæ¬ èœããŠããå Žåããªã³ã«ãŒãšã©ãŒãçºçããŸãã
å°ãæ··ä¹±ããŠããå Žåã§ããå¿é ããªãã§ãã ãããåå¿è ããã®éçãªã³ã¯æ å ±ã®ãã¹ãŠã§éè² è·ã«ãªãã®ã¯å®å šã«æ®éã§ããæåã«ããŸããããªãå Žåã¯ãäžèšã®ãã¹ãŠã念é ã«çœ®ããŠããäžåºŠè©ŠããŠãã ããã ããã§ãéçãªã³ã¯ã«åé¡ãããå Žåã¯ã FAQã»ã¯ã·ã§ã³ãŸãã¯ãã©ãŒã©ã ã§è§£æ±ºçãæ¢ããŠã¿ãŠãã ãã ã
åçïŒå ±æãšãåŒã°ããïŒã©ã€ãã©ãªãšéçã©ã€ãã©ãªã®éããããã³äœ¿çšããã©ã€ãã©ãªã®ã¿ã€ããããããªãå Žåã¯ãã€ã³ã¿ãŒãããã§è©³çŽ°ã確èªã§ããŸãã ãã®ããŒãã«é¢ããå€ãã®åªããèšäº/ããã°/æçš¿ããããŸãã
ãããžã§ã¯ãã®æºåãã§ããŸããããã¹ãŠãæ£ããæ©èœããŠããããšã確èªããã³ãŒããäœæããŸãããã main.cppãã¡ã€ã«ã«æ¬¡ã®ã³ãŒããè¿œå ããŸãã
#include <SFML/Graphics.hpp> int main() { sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); sf::CircleShape shape(100.f); shape.setFillColor(sf::Color::Green); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); } window.clear(); window.draw(shape); window.display(); } return 0; }
ããã§ãããžã§ã¯ããã³ã³ãã€ã«ããŸããSFMLã®åçããŒãžã§ã³ã§ããã°ã©ã ãã³ã³ãã€ã«ããå Žåã¯ãæ¡åŒµå.DLLã®ãã¡ã€ã«ïŒ<path-to-install-SFML> / binã«ããïŒãããã°ã©ã ã®å®è¡å¯èœãã¡ã€ã«ããããã£ã¬ã¯ããªã«ã³ããŒããããšãå¿ããªãã§ãã ããã ããã°ã©ã ãå®è¡ãããã¹ãŠãæ£ããè¡ãããå Žåãããã衚瀺ãããã¯ãã§ãã
sfml-audioã¢ãžã¥ãŒã«ã䜿çšããå ŽåïŒéçã§ãããåçã§ãããã«é¢ä¿ãªãïŒãå€éšDLLã©ã€ãã©ãªOpenAL32.dllãã³ããŒããå¿ èŠããããŸãã ãã®ãã¡ã€ã«ã¯ã <SFMLã®ã€ã³ã¹ããŒã«ãã¹> / binãã£ã¬ã¯ããªã«ããããŸãã
次ã®èšäºïŒ SFMLãšLinuxã