Skip to content

Instantly share code, notes, and snippets.

@d0ugal
Created March 1, 2016 09:47
Show Gist options
  • Save d0ugal/6e0acfea12a94d07e443 to your computer and use it in GitHub Desktop.
Save d0ugal/6e0acfea12a94d07e443 to your computer and use it in GitHub Desktop.

This is an example of a C program.

You can copy it and try to change some value to try the library.

I exptect you understand all liblapin function
</font color="#A0522D">



t_bunny_response    key(t_bunny_event_state state, t_bunny_keysym keysym, void   *my_data)
{
  t_tekgui      *tekgui;

  tekgui = my_data;
  (void) tekgui;
  if (keysym == BKS_ESCAPE && state == GO_DOWN)
    return (EXIT_ON_SUCCESS);
  return (GO_ON);
}

t_bunny_response    fonction_loop(void  *my_data)
{
  t_tekgui  *tekgui;

  tekgui = my_data;
  tekgui_display(tekgui->pix, tekgui);
  aff_window(tekgui);
  return (GO_ON);
}

int main()
{
  t_tekgui *tekgui;

  tekgui = tekgui_load("exemple.ini");
  if (tekgui == NULL)
    return (-1);
  bunny_set_key_response(key);
  bunny_set_loop_main_function(&fonction_loop);
  bunny_loop(tekgui->win, 60, tekgui);
  tekgui_stop(tekgui);
  return (0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment