กลับไปหน้าบทความ

อ่าน 10 นาที

คลังมัลติมีเดียที่ใช้งานง่ายและรวดเร็ว

Simple and Fast Multimedia Library ( SFML ) เป็น ไลบรารี การพัฒนาซอฟต์แวร์ แบบข้ามแพลตฟอร์ม ที่ออกแบบมาเพื่อมอบ อินเทอร์เฟซการเขียนโปรแกรมแอปพลิ เคชัน (API)...

คลังมัลติมีเดียที่ใช้งานง่ายและรวดเร็ว

คลังมัลติมีเดียที่ใช้งานง่ายและรวดเร็ว
ผู้เขียนต้นฉบับลอเรนต์ โกมิลา และคนอื่นๆ
นักพัฒนาทีม SFML
ปล่อย9 สิงหาคม 2550 (2007-08-09)
เวอร์ชันเสถียร
3.0.2 / 18 กันยายน 2025 (2025-09-18)
เขียนเป็นซี++
ระบบปฏิบัติการลินุกซ์ , มอสซาเรลล่า , วินโดวส์ , ฟรีบีเอสดี
พิมพ์API
ใบอนุญาตใบอนุญาต zlib [ 1 ] [ 2 ]
เว็บไซต์www.sfml-dev.org
ที่เก็บข้อมูล
  • github.com/SFML/SFML

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 ประกอบด้วยโมดูลต่างๆ ดังนี้:

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
ASFMLAda2.6
CSFML1C2.6
BeefSFMLBeef2.5
SFML.Net1.NET2.6
CrSFMLCrystal2.6
bindbc-sfmlD2.5
DSFMLD2.1
EuSFML2Euphoria2.4
csfml-fpcFree Pascal2.5
go-sfmlGo2.5.1
GoSFML2Go2.0
HackageHaskell2.3
JSFMLJava2.2
CSFML.jlJulia2.5.1
nim-csfmlNim2.3
OcsfmlOCaml2.2
OCaml-SFMLOCaml2.5.1
PasSFMLPascal2.4
pySFMLPython2.3.2
rbSFMLArchived 2018-05-27 at the Wayback MachineRuby2.3.2
rust-sfmlRust2.6.1
zig-sfmlZig2.6.1
sfml.jsNode.js2.5.1
zukoSFMLZuko2.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 ]

ตัวอย่างการใช้งานในวิดีโอเกม

ตัวอย่างเกมที่ใช้ SFML เพิ่มเติมมีอยู่ในIndieDB [ 50 ]

การใช้งานซอฟต์แวร์อื่นๆ

ดูเพิ่มเติม

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
  • Official website
  • Simple and Fast Multimedia Library on GitHub
  • SFML Tutorials

Retrieved from "https://en.wikipedia.org/w/index.php?title=Simple_and_Fast_Multimedia_Library&oldid=1339733382"

สรุปเนื้อหา

ข้อมูลสำคัญจากบทความ

ข้อมูลสำคัญเกี่ยวกับ คลังมัลติมีเดียที่ใช้งานง่ายและรวดเร็ว

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 ]