อ่าน 10 นาที
คลังมัลติมีเดียที่ใช้งานง่ายและรวดเร็ว
Simple and Fast Multimedia Library ( SFML ) เป็น ไลบรารี การพัฒนาซอฟต์แวร์ แบบข้ามแพลตฟอร์ม ที่ออกแบบมาเพื่อมอบ อินเทอร์เฟซการเขียนโปรแกรมแอปพลิ เคชัน (API)...
คลังมัลติมีเดียที่ใช้งานง่ายและรวดเร็ว
| คลังมัลติมีเดียที่ใช้งานง่ายและรวดเร็ว | |
|---|---|
โลโก้ SFML | |
| ผู้เขียนต้นฉบับ | ลอเรนต์ โกมิลา และคนอื่นๆ |
| นักพัฒนา | ทีม SFML |
| ปล่อย | 9 สิงหาคม 2550 |
| เวอร์ชันเสถียร | 3.0.2 / 18 กันยายน 2025 |
| เขียนเป็น | ซี++ |
| ระบบปฏิบัติการ | ลินุกซ์ , มอสซาเรลล่า , วินโดวส์ , ฟรีบีเอสดี |
| พิมพ์ | API |
| ใบอนุญาต | ใบอนุญาต zlib [ 1 ] [ 2 ] |
| เว็บไซต์ | www.sfml-dev.org |
| ที่เก็บข้อมูล |
|
Simple and Fast Multimedia Library ( SFML ) เป็นไลบรารีการพัฒนาซอฟต์แวร์แบบข้ามแพลตฟอร์มที่ออกแบบมาเพื่อมอบอินเทอร์เฟซการเขียนโปรแกรมแอปพลิ เคชัน (API) ที่เรียบง่ายให้กับส่วนประกอบมัลติมีเดียต่างๆ ในคอมพิวเตอร์ เขียนด้วยภาษาC++โดย มี bindingsสำหรับAda , C , Crystal , D , Euphoria , Go , Java , Julia , .NET , Nim , OCaml , Python , Ruby , Rust , Node.js , BeefและZuko [ 3 ] มีการสร้างพอร์ตสำหรับอุปกรณ์เคลื่อนที่แบบทดลองสำหรับAndroidและ iOS พร้อมกับการเปิดตัว SFML 2.2 [ 4 ]
SFML ทำหน้าที่สร้างและป้อนข้อมูลไปยังหน้าต่างรวมถึงการสร้างและจัดการ บริบท OpenGLนอกจากนี้ยังมีโมดูลกราฟิกสำหรับการเร่งความเร็วฮาร์ดแวร์ อย่างง่าย ของกราฟิกคอมพิวเตอร์ 2 มิติซึ่งรวมถึงการเรนเดอร์ข้อความโดยใช้FreeTypeโมดูลเสียงที่ใช้OpenALซึ่งถูกแทนที่ด้วยminiaudioตั้งแต่เวอร์ชัน 3.0.0 [ 5 ]และโมดูลเครือข่ายสำหรับ การสื่อสาร โปรโตคอลควบคุมการส่งข้อมูล (TCP) และโปรโตคอลข้อมูลผู้ใช้ (UDP) ขั้นพื้นฐาน
SFML เป็นซอฟต์แวร์โอเพนซอร์สฟรีที่จัดให้ภายใต้เงื่อนไขของใบอนุญาต zlib/pngสามารถใช้งานได้บนLinux , macOS , WindowsและFreeBSD [ 6 ] [ 7 ]เวอร์ชันแรก v1.0 เปิดตัวเมื่อวันที่ 9 สิงหาคม 2550 และเวอร์ชันล่าสุด v3.0.0 เปิดตัวเมื่อวันที่ 21 ธันวาคม2567 [ 8 ]
สถาปัตยกรรมซอฟต์แวร์
โมดูล
SFML ประกอบด้วยโมดูลต่างๆ ดังนี้:
- System – vector and Unicodestring classes, portable threading and timer facilities
- Window – window and input device management including support for joysticks, OpenGL context management
- Graphics – hardware acceleration of 2D graphics including sprites, polygons and text rendering
- Audio – hardware-accelerated spatialised audio playback and recording
- Network – TCP and UDP network sockets, data encapsulation facilities, HTTP and FTP classes
While the graphics module is one of the main features of SFML, developers who are interested in only creating an environment to program directly in OpenGL can do so by using the Window module on its own without the graphics module. Similarly, the other modules can also be used independently of each other, except for the System module which is used by all of the modules.
Language bindings
SFML is written in C++ and provides a C++ interface (it also provides a C interface through the official CSFML binding). Several language bindings exist that enable using SFML in other programming languages.[3]
This table lists supported bindings for SFML as of 2024.
| Name | Language | Supported version |
|---|---|---|
| ASFML | Ada | 2.6 |
| CSFML1 | C | 2.6 |
| BeefSFML | Beef | 2.5 |
| SFML.Net1 | .NET | 2.6 |
| CrSFML | Crystal | 2.6 |
| bindbc-sfml | D | 2.5 |
| DSFML | D | 2.1 |
| EuSFML2 | Euphoria | 2.4 |
| csfml-fpc | Free Pascal | 2.5 |
| go-sfml | Go | 2.5.1 |
| GoSFML2 | Go | 2.0 |
| Hackage | Haskell | 2.3 |
| JSFML | Java | 2.2 |
| CSFML.jl | Julia | 2.5.1 |
| nim-csfml | Nim | 2.3 |
| Ocsfml | OCaml | 2.2 |
| OCaml-SFML | OCaml | 2.5.1 |
| PasSFML | Pascal | 2.4 |
| pySFML | Python | 2.3.2 |
| rbSFMLArchived 2018-05-27 at the Wayback Machine | Ruby | 2.3.2 |
| rust-sfml | Rust | 2.6.1 |
| zig-sfml | Zig | 2.6.1 |
| sfml.js | Node.js | 2.5.1 |
| zukoSFML | Zuko | 2.5 |
1 Official bindings
Unofficial add-ons
SFML provides the basic functions on which higher-level software can be built. Add-on libraries exist that provide added support for graphical user interfaces (GUIs),[9][10] 2D lighting,[11]particle systems and animation,[12]video playback[13] and tilemaps.[14]
Example
This is a basic example of SFML given on the tutorial page, which draws a green circle.[15]
#include<SFML/Graphics.hpp>importstd;using sf :: Color ; using sf :: CircleShape ; using sf :: Event ; using sf :: RenderWindow ; using sf :: VideoMode ;int main () { RenderWindow window ( VideoMode ({ 200 , 200 }), "SFML works!" ); CircleShape shape ( 100.0f ); shape . setFillColor ( Color :: Green );ในขณะที่หน้าต่างเปิดอยู่ให้ตรวจสอบว่าเหตุการณ์ที่หน้าต่างเปิดอยู่หรือไม่หากเหตุการณ์นั้นปิดอยู่ให้ปิดหน้าต่างหน้าต่าง. เคลียร์(); หน้าต่าง. วาด( รูปร่าง); หน้าต่าง. แสดงผล(); } }การรับและอุปการะ
SFML ส่วนใหญ่ใช้โดยนักพัฒนาเกมมือสมัครเล่นนักพัฒนาเกมอิสระราย เล็ก และบริษัทสตาร์ทอัพที่มีนักพัฒนาเพียงไม่กี่คนเท่านั้น เนื่องจาก SFML ไม่จำเป็นต้องเขียนโค้ดจำนวนมาก จึงถูกนำไปใช้โดยผู้เข้าร่วมLudum Dare จำนวนมากเช่นกัน [ 16 ]เมื่อเทียบกับไลบรารีรุ่นเก่า เช่นSimple DirectMedia Layer (SDL) และAllegroฐานผู้ใช้ SFML ค่อนข้างเล็กแต่กำลังเติบโต ณ วันที่ 25 ธันวาคม 2024 คลังซอฟต์แวร์GitHub ของ SFML ได้รับการกดดาวจากผู้ใช้มากกว่า 10,000 ราย[ 17 ]
SFML ถูกนำมาใช้ในการสอนที่มหาวิทยาลัยและในโครงการทางวิทยาศาสตร์[ 18 ] [ 19 ] [ 20 ] [ 21 ] [ 22 ] [ 23 ]
ตัวอย่างการใช้งานในวิดีโอเกม
- Atom Zombie Smasher [ 24 ] เกม กลยุทธ์แบบเรียลไทม์
- Away Team [ 25 ] เกมจำลองสถานการณ์แบบโต้ตอบ
- หมากรุก [ 26 ]เกมปริศนา
- Cosmoscroll [ 27 ]เกมยิง อวกาศ แบบโอเพนซอร์สฟรี
- Crea [ 28 ]เกมแซนด์บ็อกซ์2มิติที่สามารถปรับแต่งได้
- ป่าต้องมนต์[ 29 ]
- Extreme Tux Racer [ 30 ] เกมแข่งรถอาร์กติกแบบโอเพนซอร์สฟรีที่มี Tux (ใช้ SFML ตั้งแต่เวอร์ชัน 0.7)
- GravytX The Gravytoid [ 31 ] เกมแอ็คชั่นแพลตฟอร์มผจญภัย 2 มิติสำหรับเว็บ มือถือ และพีซี
- HolySpirit [ 32 ]เกมแฮ็กแอนด์สแลชแบบไอโซเมตริก 3 มิติ
- ความหวัง[ 33 ]เกมผจญภัยแบบชี้และคลิก (เช่น Myst )
- ฉันสามารถแปลงร่างได้ [ 31 ] เกมแอ็คชั่นแพลตฟอร์ม 2 มิติ เล่นหลายคน (เล่นคนเดียวก็ได้) สำหรับเว็บ มือถือ และพีซี
- Jin Conception [ 34 ] เกม JRPG ศิลปะพิกเซล 2 มิติสำหรับ Nintendo Switch
- KeeperRL [ 35 ] เกมจำลองดันเจี้ย นที่มีองค์ประกอบแบบโร้กไลค์และ RPG
- Kroniax [ 36 ] เกมเลื่อนด้าน ข้างแบบเรียบง่าย และเกม SFML เกมแรกสำหรับ Android
- ทฤษฎีลิมิต [ 37 ] เกมพื้นที่อนันต์ ตามขั้นตอน
- MARS [ 38 ] เกมยิงต่อสู้แบบผู้เล่นหลายคน
- Moonman [ 39 ]เกมแซนด์บ็อกซ์สำรวจศิลปะพิกเซล
- Open Hexagon [ 40 ] โคลน Super Hexagonแบบโอเพนซอร์สฟรี
- Ovid The Owl[ 41 ]เกมแพลตฟอร์มปริศนา
- Pioneers [ 42 ] เกมสำรวจ แบบผลัดกันเล่น ที่มีองค์ประกอบ RPG บางส่วน [ 29 ]
- หลังความตาย: คนเราย่อมต้องตาย [ 43 ] เกมผจญภัยเชิงบรรยาย
- Project Black Sun [ 44 ]เกมวิดีโอแบบเลื่อนด้านข้าง2มิติย้อนยุค
- TacWars [ 45 ]เกม RPG ปริศนาที่ให้คนแคระต่อสู้กับก็อบลิน
- เกมแพลตฟอร์มแอ็คชั่น The Duke [ 46 ]
- เกมยิงปืนแนวตั้ง The Shooting of Isaac [ 47 ]
- Vagante [ 48 ]เกมแพลตฟอร์ม RPGแอ็คชั่
- Zloxx [ 49 ]เกมแพลตฟอร์มแอ็คชั่น 2มิติ
ตัวอย่างเกมที่ใช้ SFML เพิ่มเติมมีอยู่ในIndieDB [ 50 ]
การใช้งานซอฟต์แวร์อื่นๆ
- Aquila [ 51 ] ไลบรารีประมวล ผลสัญญาณดิจิทัล (DSP) แบบโอเพนซอร์สสำหรับ C++
- Otter เก็บถาวรเมื่อ 2014-12-10 ที่Wayback Machine [ 52 ] เฟรม เวิร์ก C# 2 มิติที่สร้างขึ้นบน SFML 2
- GDevelop [ 53 ]ซอฟต์แวร์สร้างเกมโอเพนซอร์ส
- Immersion Engine เก็บถาวรเมื่อ 2015-02-12 ที่Wayback Machine [ 54 ] เครื่องมือสำหรับแสดง ภาพภูมิทัศน์และสถาปัตยกรรมโดยละเอียด
- is::Engine , [ 55 ]เอ็นจิ้นเกม 2D C++ สำหรับ Nintendo Switch, เว็บ (HTML 5), มือถือ และพีซี
ดูเพิ่มเติม
Further reading
- Jan Haller, Henrik Vogelius Hansson, Artur Moreira: SFML Game Development, Packt Publishing, ISBN 1-849696-84-5
- http://www.lifehacker.com.au/2013/02/xna-is-dead-3-alternatives-that-let-you-use-your-c-and-net-skills/
- https://www.binpress.com/tutorial/creating-a-city-building-game-with-sfml/137
- http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition-The-Introduction.aspx
External links
- Official website
- Simple and Fast Multimedia Library on GitHub
- SFML Tutorials
สรุปเนื้อหา
ข้อมูลสำคัญจากบทความ
ข้อมูลสำคัญเกี่ยวกับ คลังมัลติมีเดียที่ใช้งานง่ายและรวดเร็ว
Simple and Fast Multimedia Library ( SFML ) เป็น ไลบรารี การพัฒนาซอฟต์แวร์ แบบข้ามแพลตฟอร์ม ที่ออกแบบมาเพื่อมอบ อินเทอร์เฟซการเขียนโปรแกรมแอปพลิ เคชัน (API)...
Language bindings
SFML is written in C++ and provides a C++ interface (it also provides a C interface through the official CSFML binding). Several language bindings exist that enable using SFML in other programming languages. [ 3 ]
Unofficial add-ons
SFML provides the basic functions on which higher-level software can be built.
Example
This is a basic example of SFML given on the tutorial page, which draws a green circle. [ 15 ]