Coder Social home page Coder Social logo

gtcaca's Introduction

GTcaca

Graphical Toolkit on top of libcaca.

It allows you to use widgets and have an amazing interface using code like this:

#include <gtcaca/main.h>
#include <gtcaca/window.h>

int main(int argc, char **argv)
{
  gtcaca_init(&argc, &argv);

  gtcaca_window_new("My first window", 1, 1, 50, 20);

  gtcaca_main();
  return 0;
}

Which will make the following:

Text List widget

This code:

#include <gtcaca/main.h>
#include <gtcaca/window.h>
#include <gtcaca/textlist.h>

int textlist_key_press(gtcaca_textlist_widget_t *widget, int key, void *userdata)
{
  switch(key) {
  case CACA_KEY_RETURN:
    caca_printf(gmo.cv, widget->x, widget->y + 20, "Value:%s", gtcaca_textlist_get_selected(widget));
    break;
  }
}

int main(int argc, char **argv)
{
  gtcaca_textlist_widget_t *textlist;
  
  gtcaca_init(&argc, &argv);

  gtcaca_window_new("coucou", 1, 1, 50, 20);

  textlist = gtcaca_textlist_new(2, 2);
  gtcaca_textlist_append(textlist, "myfirst");
  gtcaca_textlist_append(textlist, "mysecond");
  gtcaca_textlist_append(textlist, "mythird");

  gtcaca_textlist_key_cb_register(textlist, textlist_key_press);
  
  gtcaca_main();
  return 0;
}

Which will make this:

When the user pressed the RETURN key, we printed the value of the selection.

Widgets

Application

This is a special widget, describing your application to which you can attach the other widgets.

Text List

Choose-able list

Button

Button

Label

Label

Window

A Window.

License

This is released under public domain.

gtcaca's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

gtcaca's Issues

Does not compile on Ubuntu 22.04

The following error is produced:

[  5%] Linking C shared library libgtcaca.so
/usr/bin/ld: CMakeFiles/gtcaca.dir/log.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: multiple definition of `gmo'; CMakeFiles/gtcaca.dir/main.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: first defined here
/usr/bin/ld: CMakeFiles/gtcaca.dir/application.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: multiple definition of `gmo'; CMakeFiles/gtcaca.dir/main.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: first defined here
/usr/bin/ld: CMakeFiles/gtcaca.dir/button.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: multiple definition of `gmo'; CMakeFiles/gtcaca.dir/main.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: first defined here
/usr/bin/ld: CMakeFiles/gtcaca.dir/label.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: multiple definition of `gmo'; CMakeFiles/gtcaca.dir/main.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: first defined here
/usr/bin/ld: CMakeFiles/gtcaca.dir/textlist.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: multiple definition of `gmo'; CMakeFiles/gtcaca.dir/main.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: first defined here
/usr/bin/ld: CMakeFiles/gtcaca.dir/theme.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: multiple definition of `gmo'; CMakeFiles/gtcaca.dir/main.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: first defined here
/usr/bin/ld: CMakeFiles/gtcaca.dir/widget.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: multiple definition of `gmo'; CMakeFiles/gtcaca.dir/main.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: first defined here
/usr/bin/ld: CMakeFiles/gtcaca.dir/window.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: multiple definition of `gmo'; CMakeFiles/gtcaca.dir/main.c.o:/tmp/gtcaca/src/include/gtcaca/main.h:26: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/gtcaca.dir/build.make:238: src/libgtcaca.so.1] Error 1
make[1]: *** [CMakeFiles/Makefile2:924: src/CMakeFiles/gtcaca.dir/all] Error 2
make: *** [Makefile:160: all] Error 2

Perhaps a scoping issue.

# The system is: Linux - 5.13.0-19-generic - x86_64
$ cmake --version
cmake version 3.18.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ ld --version
GNU ld (GNU Binutils for Ubuntu) 2.37
Copyright (C) 2021 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
$ cc --version
cc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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.