Giter Club home page Giter Club logo

libagar's Introduction

Agar

What is it?

Agar is a type of sugar polymer obtained from seaweed and red algae. It becomes gelatinous in water and is primarly used as a culture medium for microbiological work. Agar (or LibAgar) is also the name of an open source GUI toolkit, a set of software libraries for building graphical user interfaces.

Agar works with a wide variety of platforms and graphics systems, from modern desktops to classic consoles and embedded devices. Its low-level layers are modular, extensible and easily ported to new hardware platforms and graphics systems. Standard drivers include:

For graphics systems without multi-window capabilities (or cases where a MDI-style interface is preferred over desktop integration), a single-window mode is provided in which case Agar provides its own internal window manager.

Agar's cascading Style Engine separates presentation details from underlying code. Style attributes including typography, colors, paddings and spacings of widgets can be assigned from a style sheet using a common language. Style Editor tool allows style changes to be viewed in real-time.

While Agar includes a standard library of general-purpose widgets, it is also designed to be extended externally. New Agar widgets can be implemented as part of an application or of an external library. Complex user interface elements can be realized often in few lines of code. The class registration interface simplifies the process.

To aid debugging, the Debug version performs type checking, object-validity and class-membership tests against object pointers passed to API calls at run-time. Agar is thread-safe when built with threads support. Public API calls are reentrant unless documented otherwise, although Agar does not rely on threads for its own operation.

Libraries included (stable)

  • CORE: Platform, I/O, object system (non graphical)
  • GUI (Base): GUI base framework
  • GUI (Widgets): GUI standard widgets
  • MATH: Matrices, vectors & advanced rendering methods
  • NET: Network interface, HTTP application server
  • VG: Vector graphics

Libraries included (beta)

  • AU: Audio interface library
  • SG: General-purpose 3D engine
  • SK: Sketches with constraints
  • MAP: Tile engine

How to install

See the provided INSTALL.md or an online installation guide:

Availability

Latest Stable Release

Latest Development Sources

License

Contributing

  • Sign up to the Patreon for exclusive content including articles, code and tutorials.
  • Contribute by donating, supporting our sponsors, reporting bugs or submitting code.

libagar's People

Contributors

julnadeauca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libagar's Issues

variable.c:26:10: fatal error: agar/core/core.h: No such file or directory

$ make install
==> core
make[1] : on entre dans le répertoire « /usr/agar/core »
make[2] : on entre dans le répertoire « /usr/agar/core »
../mk/libtool/libtool --quiet --mode=compile
cc -D_AGAR_CORE_INTERNAL -o variable.lo -c variable.c
variable.c:26:10: fatal error: agar/core/core.h: No such file or directory
#include <agar/core/core.h>
^~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [../mk/build.lib.mk:110: variable.lo] Error 1
make[2] : on quitte le répertoire « /usr/agar/core »
make: failure
make[1]: *** [../mk/build.lib.mk:201: _lib_shobjs] Error 1
make[1] : on quitte le répertoire « /usr/agar/core »
make: *** [mk/build.subdir.mk:32: all-subdir] Error 1

?

fdclose isn't portable

core/data_source.h and core/web_auth.c both have calls to fdclose, which doesn't exist on some systems, so the linking phase will fail in those systems

Regression in `AG_WidgetSurface`

Tested with this code.

When using the file->export menu in the test application, images of the graph may be saved correctly under 1.5.0, but not under the current 1.6.0 (0729b31). Specifically, the image can be saved (with the proposed changes in #18 applied), but will be entirely black.

I believe that this is a regression in AG_WidgetSurface().

pSrc not initialized in load_png

Current as of 0729b31. I think this was introduced in 631e60f.

pSrc is initialized here, but never gets updated in the branch of PNG_COLOR_TYPE_RGB, which causes segfaults like this one:

Thread 1 "graph_editor" received signal SIGSEGV, Segmentation fault.
0x00007ffff7b6f857 in ag_surface_get64_at (S=0x555556104170, p=0xff0000 <error: Cannot access memory at address 0xff0000>) at ./inline_surface.h:468
468                     return (*(Uint32 *)p);
(gdb) bt
#0  0x00007ffff7b6f857 in ag_surface_get64_at (S=0x555556104170, p=0xff0000 <error: Cannot access memory at address 0xff0000>) at ./inline_surface.h:468
#1  0x00007ffff7b7a757 in AG_SurfaceExportPNG (S=0x555556104170,
    path=0x555556092370 "/home/cad/src/teaching-learning/libraries/libagar/graph_editor/adsf.png", flags=0) at load_png.c:445
#2  0x0000555555555ba5 in ExportGraph (event=0x7fffffffced0) at main.c:197
#3  0x00007ffff7862fd2 in AG_PostEvent (sp=0x0, rp=0x555555df3b40, evname=0x7ffff7bb04be "file-chosen", fmt=0x7ffff7bb04b8 "%s,%p") at event.c:412
#4  0x00007ffff7b3cdfb in ChooseFile (fd=0x555555df3b40, pwin=0x555555def870) at file_dlg.c:344
#5  0x00007ffff7b3cb12 in CheckAccessAndChoose (fd=0x555555df3b40) at file_dlg.c:463
#6  0x00007ffff7b38f97 in PressedOK (event=0x7fffffffd6a0) at file_dlg.c:540
#7  0x00007ffff7862fd2 in AG_PostEvent (sp=0x0, rp=0x555555e4f520, evname=0x7ffff7bac61c "button-pushed", fmt=0x7ffff7bacfe1 "%i") at event.c:412
#8  0x00007ffff7aff201 in MouseButtonUp (event=0x7fffffffde10) at button.c:213
#9  0x00007ffff7862fd2 in AG_PostEvent (sp=0x0, rp=0x555555e4f520, evname=0x7ffff7b860d3 "mouse-button-up", fmt=0x7ffff7bb3911 "%i(button),%i(x),%i(y)")
    at event.c:412
#10 0x00007ffff7b761b6 in PostMouseButtonUp (win=0x555555def870, wid=0x555555e4f520, x=73, y=330, button=AG_MOUSE_LEFT) at mouse.c:207
#11 0x00007ffff7b761ec in PostMouseButtonUp (win=0x555555def870, wid=0x555555df3b40, x=73, y=330, button=AG_MOUSE_LEFT) at mouse.c:215
#12 0x00007ffff7b760d6 in AG_ProcessMouseButtonUp (win=0x555555def870, x=73, y=330, button=AG_MOUSE_LEFT) at mouse.c:302
#13 0x00007ffff7ad1386 in GLX_ProcessEvent (drvCaller=0x0, dev=0x7fffffffe288) at drv_glx.c:784
#14 0x00007ffff7ad454d in GLX_EventSink (es=0x55555576c7c0, event=0x55555576c7e0) at drv_glx.c:2063
#15 0x00007ffff78694e1 in AG_EventSinkTIMERFD () at event.c:1367
#16 0x00007ffff7869cfb in AG_EventLoop () at event.c:1624
#17 0x0000555555556360 in main (argc=1, argv=0x7fffffffe6b8) at main.c:370

I believe the solution is to replicate the initialization from here. I will try this out and see if I can get it fixed.

Also, I think that the BMP file saving logic is affected similarly. JPEG seems to have some other problem I haven't looked into yet.

How did the bindings for Ada and Perl created?

After played a bit with Agar I think it's bounded to the C language. Translating the macros used in the headers under core already hard but the thing troubled most is the Agar config. I have never seen a library put such things like include path and cflags and so on... on header file! The begin.h and close.h also weirded. So I think even if I could possible to translate 1:1 the headers into my target language it will not work. It all caused me to feel the library is bounded to the C language. But there are bindings for Ada and Perl! How could you do that? Please let me know.

I wanted to have bindings for FreeBASIC and Free Pascal so I tried to study the binding for Ada since Ada is said to be relative of Pascal. It turned out to be wrong. As soon as I saw the source I immediately have my conclusion that, I don't understand Ada!

Even if I could get through Agar config, the macros that were used intensively through out Agar is the real trouble. I'm sure I can't translate 100% of them into the target languages. So what really needed to translate? Thanks.

Use svn revision number to help diagnosticate binaries that must be recompiled

Since shared library versions are only bumped on release, users using SVN sources can easily run into problems due to installed library and executable mismatch.

We could embed the SVN version number as a define, and add a sanity check to Agar initialization to make sure that Agar programs were compiled with the same library revision as the one currently installed.

Please add binding for Free Pascal (Delphi) and FreeBASIC

I tried to create them myself but I can't. Please consider add bindings for these languages someday. Agar is awesome and I want to give the awesomeness of Agar to these communities but I don't have the skills needed to do so.

segmentation fault when creating AG_GraphVertex without a label

This fragment:

	AG_Graph* g;
	g = AG_GraphNew(win, AG_GRAPH_EXPAND);
	AG_GraphSizeHint(g, 800, 600);

	AG_GraphVertex* v1 = AG_GraphVertexNew(g, NULL);

	AG_WindowShow(win);
	AG_EventLoop();

Produces a segmentation fault:

Starting program: /home/cad/Desktop/hello
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffed1b7700 (LWP 30686)]

Thread 1 "hello" received signal SIGSEGV, Segmentation fault.
0x00007ffff7b4f69b in Draw () from /usr/local/lib/libag_gui.so.5
(gdb) bt
#0  0x00007ffff7b4f69b in Draw () from /usr/local/lib/libag_gui.so.5
#1  0x00007ffff7ac9400 in AG_WidgetDraw () from /usr/local/lib/libag_gui.so.5
#2  0x00007ffff7ace7f4 in Draw () from /usr/local/lib/libag_gui.so.5
#3  0x00007ffff7ac9400 in AG_WidgetDraw () from /usr/local/lib/libag_gui.so.5
#4  0x00007ffff7abe23a in GLX_RenderWindow () from /usr/local/lib/libag_gui.so.5
#5  0x00007ffff7acf7d8 in AG_WindowDrawQueued () from /usr/local/lib/libag_gui.so.5
#6  0x00007ffff7ac1335 in GLX_EventEpilogue () from /usr/local/lib/libag_gui.so.5
#7  0x00007ffff78578fb in AG_EventLoop () from /usr/local/lib/libag_core.so.5
#8  0x0000555555554d26 in main ()

Adding a vertex label with AG_GraphVertexLabelS() prevents the crash. I would propose that maybe AG_GraphVertexNew() should automatically initialize the label to be an empty string. Alternatively, the documentation could be updated to show that labels are required.

Error message "recipe for target 'depend' failed" when cross compiling for 32-bit windows under MinGW

$ ./configure --host=i686-w64-mingw32
$ make depend all
==> core
make[1]: Entering directory '/home/dell/libagar/libagar-master/core'
/mingw32/bin/gcc -M -D_AGAR_INTERNAL -D_BSD_SOURCE -I/home/dell/libagar/libagar-master/include -D_AGAR_CORE_INTERNAL -D_XOPEN_SOURCE=600 -Ii686-w64-mingw32 time_win32.c time_posix.c time_renderer.c net.c net_dummy.c user_win32.c variable.c config.c core.c error.c event.c object.c prop.c timeout.c class.c cpuinfo.c data_source.c load_string.c load_version.c vsnprintf.c vasprintf.c asprintf.c dir.c md5.c sha1.c rmd160.c file.c string.c dso.c tree.c time.c time_dummy.c db.c tbl.c getopt.c exec.c text.c user.c user_dummy.c
dso.c:54:40: fatal error: dlfcn.h: No such file or directory
compilation terminated.
/mingw32/bin/gcc -M -D_AGAR_INTERNAL -D_BSD_SOURCE -I/home/dell/libagar/libagar-master/include -D_AGAR_CORE_INTERNAL -D_XOPEN_SOURCE=600 -Ii686-w64-mingw32 time_win32.c time_posix.c time_renderer.c net.c net_dummy.c user_win32.c variable.c config.c core.c error.c event.c object.c prop.c timeout.c class.c cpuinfo.c data_source.c load_string.c load_version.c vsnprintf.c vasprintf.c asprintf.c dir.c md5.c sha1.c rmd160.c file.c string.c dso.c tree.c time.c time_dummy.c db.c tbl.c getopt.c exec.c text.c user.c user_dummy.c
dso.c:54:40: fatal error: dlfcn.h: No such file or directory
compilation terminated.
../mk/build.dep.mk:33: recipe for target 'depend' failed
make[1]: *** [depend] Error 1
make[1]: Leaving directory '/home/dell/libagar/libagar-master/core'
mk/build.subdir.mk:168: recipe for target 'depend-subdir' failed
make: *** [depend-subdir] Error 1

segfault in debugger -- object with non-malloc-ed drv->name

Relevant GDB session:

Thread 1 "graph_editor" hit Breakpoint 1, WidgetSelected (event=0x7fffffffd5c0) at debugger.c:334
334                             AG_LabelNewPolled(nTab, AG_LABEL_HFILL, _("Cursor driver: %s"),
(gdb) p wid
$1 = (AG_Widget *) 0x555555786f70
(gdb) p wid->drv
$2 = (struct ag_driver *) 0x100000001
(gdb) p drv
$3 = (AG_Driver *) 0x100000001
(gdb) p drv->name
There is no member named name.
(gdb) p ((struct ag_object*)(drv))
$4 = (struct ag_object *) 0x100000001
(gdb) p ((struct ag_object*)(drv))->name
Cannot access memory at address 0x100000001
(gdb)

And the back-trace

Thread 1 "graph_editor" received signal SIGSEGV, Segmentation fault.
0x00007ffff7876115 in AG_Strlcpy (dst=0x5555561ad56f "",
    src=0x100000002 <error: Cannot access memory at address 0x100000002>, dsize=112) at string.c:733
733                             if ((*dst++ = *src++) == '\0')
(gdb) bt
#0  0x00007ffff7876115 in AG_Strlcpy (dst=0x5555561ad56f "",
    src=0x100000002 <error: Cannot access memory at address 0x100000002>, dsize=112) at string.c:733
#1  0x00007ffff78759ce in AG_ProcessFmtString (fs=0x5555557b6e00, dst=0x5555561ad560 "Cursor driver: ", dstSize=128)
    at string.c:325
#2  0x00007ffff7afcf98 in DrawPolled (lbl=0x5555560ebda0) at label.c:403
#3  0x00007ffff7afca31 in Draw (obj=0x5555560ebda0) at label.c:484
#4  0x00007ffff7adee51 in AG_WidgetDraw (p=0x5555560ebda0) at widget.c:1329
#5  0x00007ffff7afaf4a in Draw (obj=0x5555560e97a0) at box.c:195
#6  0x00007ffff7ae0043 in AG_WidgetInheritDraw (obj=0x5555560e97a0) at widget.c:1723
#7  0x00007ffff7adee51 in AG_WidgetDraw (p=0x5555560e97a0) at widget.c:1329
#8  0x00007ffff7b35d8a in Draw (obj=0x55555607c730) at notebook.c:134
#9  0x00007ffff7adee51 in AG_WidgetDraw (p=0x55555607c730) at widget.c:1329
#10 0x00007ffff7afaf4a in Draw (obj=0x555555df8280) at box.c:195
#11 0x00007ffff7adee51 in AG_WidgetDraw (p=0x555555df8280) at widget.c:1329
#12 0x00007ffff7b58af4 in Draw (obj=0x555555df2fd0) at pane.c:343
#13 0x00007ffff7adee51 in AG_WidgetDraw (p=0x555555df2fd0) at widget.c:1329
#14 0x00007ffff7ae73d9 in Draw (obj=0x555555deee20) at window.c:630
#15 0x00007ffff7adee51 in AG_WidgetDraw (p=0x555555deee20) at widget.c:1329
#16 0x00007ffff7ad1772 in GLX_RenderWindow (win=0x555555deee20) at drv_glx.c:870
#17 0x00007ffff7ae34db in AG_WindowDrawQueued () at window.c:967
#18 0x00007ffff7ad45fa in GLX_EventEpilogue (es=0x55555576cac0, event=0x55555576cae0) at drv_glx.c:2079
#19 0x00007ffff7869d4f in AG_EventLoop () at event.c:1631
#20 0x000055555555642b in main (argc=1, argv=0x7fffffffe6b8) at main.c:378

See attached screenshot -- I had just clicked on the "cursors" tab. I'm not sure I know enough about Agar's internals to debug this further. This is the application I was using to test with.

screenshot_2019-06-07_at_16_31_26

Button right-align does not work

I am just starting to learn Agar coding. The program below does work, though there are some issues. I will study some more, however, one thing that has me stumped, is AG_BOX_RIGHT does not do anything, the "Help" and "OK" buttons still display on the left.

Might as well mention one other thing. The code selects a monospace font, DejaVuSansMono, but that has no effect either.

#include <agar/core.h>
#include <agar/gui.h>

AG_Textbox *tb1;
int showflg = 1;
AG_Button *bpw;

void HelpHandlerFn(AG_Event *event)
{
  char* helpstr =
   "This is a very simple example help popup.\n"
   "Invoked by pressing the Help button.";
  AG_TextMsg(AG_MSG_INFO, helpstr, AG_STRING(1));
}

void OKHandlerFn(AG_Event *event)
{
  AG_Terminate(0);
}

void ShowHandlerFn()
{
  if (showflg==1) {
   showflg=0;
   AG_ButtonTextS(bpw, "Hide");
  }
  else {
   showflg=1;
   AG_ButtonTextS(bpw, "Show");
  }
  AG_TextboxSetPassword(tb1,showflg);
}

int main(int argc, char *argv) {
  AG_Window *win;
  char pw[32];
  AG_Box *box1, *box2;
  AG_Font *fnt1;
  
  if (AG_InitCore(NULL, 0) == -1 || AG_InitGraphics(0) == -1) {
    return (1);
  }
  win = AG_WindowNew(AG_WINDOW_MAIN|AG_WINDOW_PLAIN);
  
  fnt1 = AG_FetchFont("DejaVuSansMono",20,0); /*20 pixels*/
  AG_TextFont(fnt1);
  
  AG_LabelNew(win, 0, "Hello, world!");
  
  box2 = AG_BoxNewHoriz(win, 0);
  tb1 = AG_TextboxNew(box2, AG_TEXTBOX_MULTILINGUAL, "Password: ");
  /*AG_TextboxBindUTF8(tb1, pw, sizeof(pw));*/
  AG_TextboxSetPassword(tb1,showflg); /*default to show asterisks*/
  AG_TextboxClearString (tb1); /*it does not default to empty*/
  AG_TextboxSizeHint (tb1, "12345678901234567890");
  AG_TextboxSetLang (tb1,AG_LANG_RU); /*ref: include/core/text.h*/
  bpw = AG_ButtonNewFn(box2, 0, "Show", ShowHandlerFn, "");

  box1 = AG_BoxNewHoriz(win, 0);
  AG_BoxSetHorizAlign (box1,AG_BOX_RIGHT);
  AG_ButtonNewFn(box1, 0, "Help", HelpHandlerFn, "%s", "world");
  AG_ButtonNewFn(box1, 0, "OK", OKHandlerFn, "");
  
  AG_WindowShow(win);
  
  AG_EventLoop();
  AG_DestroyGraphics();
  AG_Destroy();
  return (0);
}

GLX: Numerical perturbations while moving hierarchies of pinned windows across desktops

Hierarchies of pinned windows are used notably by dropdown and popup menus. AG_Menu creates sub-windows corresponding to the sub-items of a menu.

AG_DriverGLX relies on X Windows' ConfigureNotify in order to move pinned windows in response to their parent window being moved.

However, the reporting is not 100% accurate especially when moving across desktops, and this becomes more obvious with deeper levels of pinning. The deeper the menus, the more hilarious.

Could you provide AG_OBJECT as a seperate library, too?

Is AG_OBJECT a generic object system which provide OOP like features for the C language or just have meaning inside Agar? If it's generic could you consider to provide it as a seperate library alongside with Agar? LibAgar in it full state requires many dependencies and provides many features and we only need at most Agar Core. The fact is only Agar Object is more than enough. I think the Agar Object System is awesome and if I could use it in embedded development it's very cool.

I tried to extract just Agar Object from the current Agar source but failed because lack of knowledge about the internal of Agar. So I think only the creator of it could do that.

Let me clarify, I only want to have Agar Object System as a separate library. I don't want you to strip it from the current Agar. Just another standalone version. Please let me know what you think. Thanks.

freetype-config is deprecated, should use pkg-config instead

The freetype-config tool is deprecated and configuration script should use pkg-config instead for detecting whether freetype library can be used. For example Ubuntu 19.04 has already dropped freetype-config from libfreetype6-dev package, so compiling libagar becomes impossible, without hacking the script.

Notebook must provide better visual feedback

Make Notebook provide better visual feedback to the user. The tabs should be styled on mouseover. Make the tabs drag and droppable. Minimal animation should be provided to alert the user of the creation and destruction of tabs.

2019_09_12 Cloned Source Fails to Build on openSUSE Linux

The whole console output MIGHT be available from

https://temporary.softf1.com/2019/bugs/2019_09_12_Agar_Fails_to_Compile_bugreport_t1.txt

but the first error seems to be

gcc -M  -march=native -D_AGAR_INTERNAL -D_DEFAULT_SOURCE -D_BSD_SOURCE -I/home/ts2/m_local/lib/Agar/kompil/libagar/include -D_XOPEN_SOURCE=600 -D_AGAR_CORE_INTERNAL -Ix86_64-unknown-linux-gnu byteswap.c class.c config.c core.c cpuinfo.c data_source.c db.c dir.c dso.c error.c event.c exec.c file.c getopt.c load_integral.c load_real.c load_string.c load_version.c object.c string.c tbl.c text.c time.c time_dummy.c timeout.c threads.c vasprintf.c vsnprintf.c user.c user_dummy.c user_getenv.c variable.c vec.c time_posix.c time_renderer.c time_gettimeofday.c net.c net_dummy.c net_bsd.c user_posix.c
In file included from /usr/include/sys/types.h:132:0,
                 from /usr/include/stdlib.h:314,
                 from /home/ts2/m_local/lib/Agar/kompil/libagar/include/agar/core/core.h:40,
                 from byteswap.c:7:
./time.h:4:3: error: #error "Must be included by object.h"
 # error "Must be included by object.h"
   ^~~~~
In file included from /usr/include/sys/select.h:43:0,

I do admit that I am running relatively old openSUSE version, "openSUSE Leap" version 42.3, but that should not be a problem for a GUI library that aims to be portable.

Implement a date picker widget

The standard library doesn't include a way to select dates or time. This should take relatively little code to implement.

Hello World example was broken

I posted this question on the "agar" mail-list, but there is no action there, so reposting here.

The libagar.org website has a Hello World example, hello.c. Testing with the Linux framebuffer, closing the window just resulted in a black screen, had to hold down the power button to reboot.

Here is the original hello.c:

#include <agar/core.h>
#include <agar/gui.h>
int main(int argc, char *argv) {
  AG_Window *win;
  if (AG_InitCore(NULL, 0) == -1 || AG_InitGraphics(0) == -1) {
    return (1);
  }
  win = AG_WindowNew(0);
  AG_LabelNew(win, 0, "Hello, world!");
  AG_WindowShow(win);
  AG_EventLoop();
  return (0);
}

After comparing with "agartest", I changed hello.c to this:

#include <agar/core.h>
#include <agar/gui.h>

int main(int argc, char *argv) {
  AG_Window *win;
  if (AG_InitCore(NULL, 0) == -1 || AG_InitGraphics(0) == -1) {
    return (1);
  }
  win = AG_WindowNew(AG_WINDOW_MAIN);
  AG_LabelNew(win, 0, "Hello, world!");
  AG_WindowShow(win);
  AG_EventLoop();
  AG_DestroyGraphics();
  AG_Destroy();
  return (0);
}

The most important is that flag AG_WINDOW_MAIN. I also put in AG_DestroyGraphics() and AG_Destroy(), as agartest has them, however they ARE NOT DOCUMENTED.

Now get a return to console prompt when close the window.

last git version does not compile

I'm testing new lib version, in particular up to commit 8e5a2e4
At the very beginning of the compilation in the gui directory I receive the following messages:
*In file included from /tmp/libagar-master/include/agar/gui/widget.h:12,
from /tmp/libagar-master/include/agar/gui/window.h:6,
from drv_gl_common.c:32:
/tmp/libagar-master/include/agar/gui/surface.h:902:1: error: multiple storage classes in declaration specifiers
extern DECLSPEC typedef AG_Surface AG_Anim;
^~~~~~
/tmp/libagar-master/include/agar/gui/surface.h:916:1: error: multiple storage classes in declaration specifiers
extern DECLSPEC typedef AG_AlphaFn AG_BlendFn;
^~~~~~
drv_gl_common.c:849:35: error: expected ';', ',' or ')' before 'obj'
AG_GL_DrawTriangle(void _Nonnull obj, AG_Pt v1, AG_Pt v2, AG_Pt v3, AG_Color c)
^~~
make[2]: *** [../mk/build.lib.mk:135: drv_gl_common.o] Error 1
make[2]: Leaving directory '/tmp/libagar-master/gui'
make: failure
make[1]: *** [../mk/build.lib.mk:260: _lib_objs] Error 1
make[1]: Leaving directory '/tmp/libagar-master/gui'
make: *** [mk/build.subdir.mk:32: all-subdir] Error 1

I'm on Linux Debian with gcc 8.2.0
Thank you.
Ciao.
Gigi

Updating Instructions for how to install on Cocoa /macOS

Hi! Just tried to configure / install LibAgar. Excited to use it but I'm getting a few errors on my Mac running Mojave 10.14.6.

The first was 1 error. This header wasn't found.

#include <GL/glu.h>

Fair enough. Fixed it using the technique here: https://stackoverflow.com/questions/3907818/opengl-headers-for-os-x-linux

#if defined(_AGAR_SG_INTERNAL) || defined(_USE_SG_GL)
#ifdef __APPLE__
#include <OpenGL/glu.h>
#else
# include <GL/glu.h>
#endif
#endif

But now I get these errors related to the OpenGL deprecation.

vg_view.c:790:3: warning: 'glBegin' is deprecated: first deprecated in macOS
      10.14 - OpenGL API deprecated. (Define GL_SILENCE_DEPRECATION to silence
      these warnings) [-Wdeprecated-declarations]

Not sure what OpenGL to install or how to reference the install. Will update if I figure it out. :)

Windows 10 libag_gui build error (MinGW-w64)

Hi,
I follow this explanation https://libagar.org/docs/inst/win-mingw64.html but I have a problem. During make install I have the following warning:

libtool: install: `libag_gui.la' is not a valid libtool archive
libtool: install: Try `libtool --help --mode=install' for more information.
../mk/libtool/libtool --quiet --finish /usr/x86_64-w64-mingw32/sys-root/mingw/lib
install -c -m 644 style.css /usr/x86_64-w64-mingw32/sys-root/mingw/share/agar


*** Warning: linker path does not have real file for library -lag_gui.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libag_gui but no candidates were found. (...for file magic test)
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.

And in the MinGW folder I don't have libag_gui.a (but I have others). And When I compiled the hello.c example, I get the following error:

can't find -lag_gui
collect2: error: ld returned exit status 1

Because the .a file don't exist.
I using the last Cygwin64 version and Windows 10 (last version).
Any idea?

compile error

/usr/bin/clang -D_AGAR_INTERNAL -D_DEFAULT_SOURCE -D_BSD_SOURCE  -I/home/chris/development/dlang/agar/libagar/include -D_AGAR_CORE_INTERNAL -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600          -fPIC -o object.o -c object.c
object.c:1716:3: error: use of undeclared identifier 'debugSave'
                debugSave = 0;

don't know if configure has missed something ?

The (double-click) word by word selection mode of AG_Editable trashes the cursor around

In the WORDSELECT mode of AG_Editable (triggered by double clicking), the cursor must be moved to the beginning of the word boundary. This moving of the cursor causes problems when the selection is reversed and it jumps around.

The only solution I can think of involves changing the way selections are represented from the current single position and offset to a position and two offsets, normalized such that sel1 < sel2. This would also help reduce the number of operations that the rendering routine must do to determine the start of the selection-indicating rectangle.

dyld: Symbol not found: _AG_GL_BackupSurfaces

I installed libagar into my Mac Mojave by the following steps, according to the official guide.

First, I installed SDL1.2 . (I don't know it's needed though)

$ brew install sdl

Next, I executed the following:

$ tar -xzf agar-1.5.0.tar.gz
$ cd agar-1.5.0.tar.gz
$ ./configure --prefix=$HOME/lib/agar
$ make depend all
$ make install

Then I created a file named hello.c according to the bottom of the page. I successfully compiled it, but when I try running, an dynamic library loading error occurs:

$ cc -o hello (~/lib/agar/bin/agar-config --cflags | string split " ") hello.c (~/lib/agar/bin/agar-config --libs | string split " ")
$ ./hello
dyld: Symbol not found: _AG_GL_BackupSurfaces
  Referenced from: /Users/$USER/lib/agar//lib/libag_gui.5.dylib
  Expected in: flat namespace
 in /Users/$USER/lib/agar//lib/libag_gui.5.dylib
fish: './hello' terminated by signal SIGABRT (Abort)

(where $USER is actually the username of my PC.)

What am I getting wrong? How can I fix this problem?

__inline__ and dlsym

Hello, Vedge,

Huge fan of libagar. I'm Brian Tiffin, with the GnuCOBOL project (in Ottawa by the way), and have almost finished up on a user defined function repository binding to a fair number of Agar features and widgets.

I work on a GNU/Linux 64bit machine, and some of the inline modifiers are making the integration a little tricky. The GnuCOBOL CALL verb relies on dynamic linking via dlsym. Some functions, AG_Unit2Unit for instance are coming up

prompt$ cobc -xj units.cob $(agar-config --libs)
libcob: cannot find module 'AG_Unit2Unit'

Some of the COBOL for this trial

   call "AG_FindUnit" using
       by content "ft" & x"00"
       returning address of agar-feet
   call "AG_FindUnit" using
       by content "m" & x"00"
       returning address of agar-metres

   move pi to metres

   call "AG_Unit2Unit" using
       by value metres
       by reference agar-metres agar-feet
       returning feet

The static inline double declaration is not creating a dlsym findable link symbol. Where as the FindUnit call works ok, due to the entry in BEGIN_DECLS, sans inline. This issue is many fold worse when trying (salivating for) AG_Web and --enable-web 1.5.1 builds.

To give you a more complete picture, I've documented most of the work behind the current bindings in a thread on SourceForge, https://sourceforge.net/p/open-cobol/discussion/cobol/thread/c2ac66c1/

The objective with the function repository is for developer code in COBOL along the lines of

move agar-unit2unit(metric-measure, ag-metres, ag-feet) to standard-measure

I've hacked up a compile of 1.5.1 on Ubuntu and Fedora so far, but I'm a bit defeated on finding the symbols that are small t and not big T in nm listings.

One technical point, seemed easy to get round in web.c. GNU/Linux has no sun_len element in sockaddr_un the and it only seems to be a place holder (perhaps needed when the field is supported), but the code lines end up as sunLen = strlen(sun.sun_path)+1 + sizeof(sun.sun_family); which gcc doesn't choke on. Alas, I've not gotten to testing much 1.5.1 due to my less than stellar attempts at getting the storage classes correct, complicated by compile time or link time fails.

And now, I'm asking for a little advice. Do I try and maintain a patch set exposing some of the inline definitions that end up with no entry point? Or might I ask for more direct assistance in getting clean shared libraries on GNU/Linux and perhaps a more solid binding to Agar from COBOL? Big Smiley here, maybe the puppy dog eyes if you can see them?

It's a nice toolkit, Vedge. I'm really looking forward to bragging about GnuCOBOL with Web features. There is already a demo of AG_Net as COBOL functions in the link above.

If this all works out, and it'll be some work, there will be trials of runtime checks for COBOL screen section (curses based terminal user interface) to Agar based graphical user interface, no change to the COBOL required. That's a dream, and it will take some work, so, may happen. Dreams do sometimes come true.

Have good, make well,
Brian

.../tests/configure is giving error

I have downloaded "master" and compiled it with the following statements :

./configure --prefix=pwd/Installed
make -i -k depend all
make -i -k install

"Installed" directory has : bin , include , lib , lib64 , local , share directories .
Perhaps , during install , it deleted "lib64" , "local" directories , and created a "man" directory .

In tools directory both

./configure --prefix=pwd/Installed
./configure

statements gave errors .

In tests directory

[s@localhost tests]$ ./configure --prefix=pwd/../Installed
BSDBuild 3.2 http://bsdbuild.hypertriton.com/
checking for a C compiler...yes, /usr/bin/cc
checking whether the C compiler works...yes
cc: checking for compiler warning options...yes
cc: checking for long double...yes
cc: checking for long long...yes
cc: checking for cygwin environment...no
cc: checking for -mwindows option...no
cc: checking for -mconsole option...no
checking for Agar...no
*

  • This software requires agar installed on your system.
  • It is available from: http://libagar.org

configure failed!
[s@localhost tests]$

means in ./configure , --prefix has been ignored

Is there any possibility , please ,

(1) Combine "configure" statements into "configure" in "master" directory , and build sub directory parts with "make" options .

or

(2) Correct the above errors .

If you download "master" into a machine which does not have any "libagar" related installations , you may reproduce the above problems .

"libagar" 1.5.0 downloaded from http://libagar.org is also NOT buildable ...

OS :
[s@localhost tests]$ uname -a
Linux localhost.localdomain 4.17.18-200.fc28.x86_64 #1 SMP Wed Aug 22 19:08:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[s@localhost tests]$

Fedora 28

Thank you very much for your contributions .

segmentation fault when viewing surfaces in GUI debugger

I am under the impression that 1.6 is going to make some changes, so this may not be applicable any longer. However, under 1.5 on Ubuntu 18.04, I get a segmentation fault when clicking the "Surfaces" tab, but only on certain window elements.

Here is the program I'm working on:

/* Minimal application using Agar-GUI */

#include <agar/core.h>
#include <agar/gui.h>

void QuitApplication(AG_Event *event) {
	AG_Quit();
}

#ifdef ENABLE_DEBUGGER
void LaunchDebugger(AG_Event *event) {
	AG_Window* win;
	AG_Window* db_window;

	win = (AG_Window*) AG_ObjectRoot(AG_SELF());

	db_window = AG_GuiDebugger(win);
	AG_WindowShow(db_window);
}
#endif


int main(int argc, char *argv[]) {
	AG_Window *win;

	if (AG_InitCore(NULL, 0) == -1 ||
	    AG_InitGraphics(0) == -1)
		return (1);

	win = AG_WindowNew(0);
	AG_WindowSetCaptionS (win, "Graph Editor");

	AG_Menu* menu = AG_MenuNew(win, 0);
	AG_MenuItem* menu_file = AG_MenuNode(menu->root, "File", NULL);
	AG_MenuAction(menu_file, "Quit", NULL, QuitApplication, NULL);

#ifdef ENABLE_DEBUGGER
	AG_MenuAction(menu_file, "Launch Debugger", NULL, LaunchDebugger, NULL);
#endif

	AG_WindowShow(win);

	AG_EventLoop();
	return (0);
}

I am able to view the surfaces in say the AG_MenuView #0 (under glx3), but viewing the surfaces for glx1 produces a segfault. I have attached a log which includes both Agar's debug output, and a GDB backtrace.

gdb.log

Introduce a "font-tranform" property

To specify a general transformation matrix in agar css.

For example, to render text 1/3 condensed:
font-transform: [ 0.333, 0.0, 1.0, 0.0 ]
or render 12 degrees oblique:
font-transform: [ 1.0, 0.207, 1.0, 0.0 ]

Please add this to nuget

Please add this to nuget.
Its very hard to follow your visual studio installation instructions as they are meant for really old versions of visual studio.

if anything there needs to be a set of instructions for newer versions like visual studio 2017 and 2019

Better integrated glob and autocomplete in FileDlg

In FileDlg, integrate the glob function with the embedded Textbox to provide auto-complete (and update any active selection based on filesystem events). Currently FileDlg's glob only fires when matching wildcard characters.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.