مكتبة تجريد من المنصات المتقاطعة ذات الاتفاقية المتقاطعة ذات الاستخدام البسيط للغاية لإنشاء مكتبات رسومات أو برامج رسومية بسيطة. مكتوبة في C99 النقي.
RGFW عبارة عن إطار تجريدي مجاني متعدد المنصات متعدد المنصات للغاية لإنشاء مكتبات رسومات أو برامج رسومية بسيطة. من المفترض أن تستخدم كمكتبة بديلة صغيرة ومرنة إلى GLFW.
يدعم الواجهة الخلفية للنافذة XLIB (UNIX) ، والكوكوا (MACOS) ، و Webasm (emscripten) و Winapi (تم اختبارها على Windows XP و 10 و 11 و Reactos)
تم اختبار Windows 95 و 98 أيضًا باستخدام RGFW ، على الرغم من أن النتائج هي IFFY
Wayland: لتجميع Wayland ADD (RGFW_Wayland = 1). دعم Wayland هو تجريبي للغاية وكسر.
تدعم الواجهة الخلفية للرسومات OpenGL (EGL ، البرمجيات ، OSMESA ، GLES) ، Vulkan ، DirectX ، مخازن لتقديم المعادن والبرامج.
تم تصميم RGFW كواجهة خلفية لـ RSGL ، ولكن يمكن استخدامها مستقلة أو للمكتبات الأخرى ، مثل Raylib التي تستخدمه كخلف بديل اختياري.
RGFW متعددة البرامج ،
بشكل افتراضي ، يستخدم RGFW نظام أحداث مرن ، على غرار نظام SDL ، ومع ذلك يمكنك استخدام عمليات الاسترجاعات إذا كنت تفضل هذه الطريقة.
هذه المكتبة
هذه المكتبة لا
#define RGFW_IMPLEMENTATION
#include "RGFW.h"
void keyfunc ( RGFW_window * win , u32 keycode , char keyName [ 16 ], u8 lockState , u8 pressed ) {
if ( keycode == RGFW_Escape && pressed ) {
RGFW_window_setShouldClose ( win );
}
}
int main () {
RGFW_window * win = RGFW_createWindow ( "a window" , RGFW_RECT ( 0 , 0 , 800 , 600 ), ( u16 )( RGFW_CENTER | RGFW_NO_RESIZE ));
RGFW_setKeyCallback ( keyfunc ); // you can use callbacks like this if you want
while ( RGFW_window_shouldClose ( win ) == RGFW_FALSE ) {
while ( RGFW_window_checkEvent ( win )) { // or RGFW_window_checkEvents(); if you only want callbacks
// you can either check the current event yourself
if ( win -> event . type == RGFW_mouseButtonPressed && win -> event . button == RGFW_mouseLeft ) {
printf ( "You clicked at x: %d, y: %dn" , win -> event . point . x , win -> event . point . y );
}
// or use the existing functions
if ( RGFW_isMousePressed ( win , RGFW_mouseRight )) {
printf ( "The right mouse button was clicked at x: %d, y: %dn" , win -> event . point . x , win -> event . point . y );
}
}
glClearColor ( 0.1f , 0.1f , 0.1f , 1.0f );
glClear ( GL_COLOR_BUFFER_BIT );
// You can use modern OpenGL techniques, but this method is more straightforward for drawing just one triangle.
glBegin ( GL_TRIANGLES );
glColor3f ( 1 , 0 , 0 ); glVertex2f ( -0.6 , -0.75 );
glColor3f ( 0 , 1 , 0 ); glVertex2f ( 0.6 , -0.75 );
glColor3f ( 0 , 0 , 1 ); glVertex2f ( 0 , 0.75 );
glEnd ();
RGFW_window_swapBuffers ( win );
}
RGFW_window_close ( win );
return 0 ;
}linux : gcc main.c -lX11 -lGL -lXrandr -lm
windows : gcc main.c -lopengl32 -lshell32 -lgdi32 -lwinmm -lm
macos : gcc main.c -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo -lm
يمكنك العثور على المزيد من الأمثلة هنا أو تشغيله في متصفحك مع emscripten
يمكن العثور على قائمة بمكتبات واجهة المستخدم الرسومية التي يمكن استخدامها مع RGFW على wiki RGFW هنا
هناك الكثير من الوثاق الداخلي ، ولكن يمكن العثور على المزيد من الوثائق على https://colleagueriley.github.io/rgfw/docs/index.html إذا كنت ترغب في بناء الوثائق بنفسك ، فهناك أيضًا ملف doxygen متصل.
يمكن العثور على قائمة بالارتباطات على wiki RGFW هنا
يمكن العثور على قائمة بالمشاريع التي تستخدم RGFW على RGFW Wiki هنا
هناك صفحة wiki RGFW حول الأشياء التي يمكنك القيام بها إذا كنت ترغب في دعم تطوير RGFW هنا.
يمكن العثور على مقارنة RGFW و GLFW في الويكي
يستخدم RGFW ترخيص ZLIB/LIBPNG ، وهذا يعني أنه يمكنك استخدام RGFW بحرية طالما أنك لا تدعي أنك كتبت هذا البرنامج ، وعلامة الإصدارات التي تم تغييرها على هذا النحو والحفاظ على الترخيص المضمّن مع الرأس.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.