Successfully reported this slideshow.
Your SlideShare is downloading. ×

There is more to C

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad

Check these out next

1 of 58 Ad

More Related Content

Slideshows for you (20)

Similar to There is more to C (20)

Advertisement

More from Juraj Michálek (20)

Recently uploaded (20)

Advertisement

There is more to C

  1. 1. There is more to C 26.11. 2012 FI MUNI Juraj Michálek http://georgik.sinusgear.com http://twitter.com/sinusgear
  2. 2. Something about me ;-)
  3. 3. Content Why C rocks? libuv
  4. 4. #1 language 2012 http://www.tiobe.com
  5. 5. Trends
  6. 6. Interactive C - Robot ● Handyboard ● Motorola 68AX11 ● derrived from C ● http://www.kipr.org ● http://www.boatball.org
  7. 7. Portability Linux – Windows – Mac – BSD http://suacommunity.com/
  8. 8. Clone examples Available at GitHub: https://github.com/georgik/fimuni-c-cpp-examples git clone git://github.com/georgik/fimuni-c-cpp-examples.git
  9. 9. Allegro Allegro Low Level Game Routines
  10. 10. Allegro - features keyboard, mouse, touch screen audio, video, graphics timers, events data files
  11. 11. Allegro 5.1 Win, Lin, Mac iOS, Android http://alleg.sourceforge.net/a5docs/refman/
  12. 12. Initialization al_init();
  13. 13. Graphic environment al_create_display(int w, int h)
  14. 14. ALLEGRO_BITMAP Structure for bitmaps ALLEGRO_BITMAP *bmp = create_bitmap(x,y);
  15. 15. Graphics al_putpixel(x, y, color) al_load_bitmap(filename); al_draw_bitmap(bmp, 10, 10, 0);
  16. 16. Release memory al_destroy_bitmap(bmp);
  17. 17. Keyboard al_install_keyboard() al_uninstall_keyboard() event.keyboard.keycode
  18. 18. Mouse al_install_mouse() al_uninstall_mouse() al_get_mouse_state(&msestate);
  19. 19. Additional Allegro libraries Allegttf - True Type fonts support AllegGL – HW accelerated graphics DUMB - audio (Vorbis/Ogg)
  20. 20. Compilation Configuration script: allegro-config Linux, Unix, MacOS: gcc foo.cc -o foo `allegro-config --libs` gcc foo.cc -o foo `pkg-config --libs --cflags allegro-5.0` iPhone – requires Xcode Android – requires Android SDK
  21. 21. CMake – Cross Platform Make http://www.cmake.org
  22. 22. Allegro – CMake – MSVC 2012 Requires: DirectX SDK (e.g. Windows SDK for Windows 8) Small tweak to run examples: http://georgik.sinusgear.com/2012/11/18/allegro5-1-and-visual-studio-2012-unable-to-start-examples-missing-dll-files/
  23. 23. Allegro – CMake - KDevelop4
  24. 24. Sources Library: http://alleg.sourceforge.net Wiki: http://wiki.allegro.cc/
  25. 25. Game development community network http://www.allegro.cc
  26. 26. Simple Direct Media Layer
  27. 27. Init/quit SDL_init(flags) SDL_quit()
  28. 28. Graphics SDL_SetVideoMode(width, height, video_bpp, videoflags) Store in memory: SDL_SWSURFACE Store on graphics card: SDL_HWSURFACE
  29. 29. Visual data SDL_Surface SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, rmask, gmask, bmask, amask);
  30. 30. Visual data SDL_Surface *SDL_LoadBMP(const char *file) Copy from one memory to another: SDL_BlitSurface(src, srcrect, dst, dstrect);
  31. 31. Keyboard SDL_PollEvent(SDL_Event *event) event.key.keysym.sym
  32. 32. Timer static int counter; SDL_SetTimer(interval, tick_callback);
  33. 33. Mouse SDL_GetMouseState(*x, *y);
  34. 34. Text Not implemented
  35. 35. Extensions support for GL extension for many languages Ada, Eiffel, Java, Lua, Perl, PHP, Pike, Python, Ruby 176 additional libraries
  36. 36. SDL based Libraries SDL_mixer – audio mixer SDL_image – image formats SDL_net – network support
  37. 37. Source http://www.libsdl.org
  38. 38. Compilation sdl-config Linux, Windows, BeOS, Mac OS gcc foo.cc -o foo `sdl-config --libs`
  39. 39. PyGame Power of C and Power of Python http://www.pygame.org
  40. 40. http://nodejs.org/
  41. 41. Architecture of Node.js
  42. 42. libuv High performance evented I/O library which offers the same API on Windows and Unix
  43. 43. libuv https://github.com/joyent/libuv http://nikhilm.github.com/uvbook/index.html
  44. 44. libuv – event loop Call callbacks Sleep
  45. 45. libuv - example
  46. 46. Features Filesystem Networking Threads Processes Utilities
  47. 47. TCP server example
  48. 48. http://www.gtk.org
  49. 49. GTK GIMP ToolKit C++, Guile, Perl, Python, TOM, Ada95, Objective C, Free Pascal, Eiffel...
  50. 50. Glade 3 http://glade.gnome.org
  51. 51. Valgrind debugging a profiling memcheck helgrind - race condition, thread profiling
  52. 52. Modes debugger Local application Attach to local process Attach to remote process Post-mortem
  53. 53. Application crashed Post-mortem analysis Image from memory: coredump
  54. 54. Quick analysis of coredump
  55. 55. Strace
  56. 56. Mutextrace ● mutextrace ./mutex-tester-app param1 param2 – lock #1, free -> thread 1 – init #2 – lock #2, free -> thread 1 – unlock #1 – lock #1, free -> thread 1 – init #3 – lock #3, free -> thread 1 – unlock #1
  57. 57. http://www.se-radio.net
  58. 58. EOF 26.11. 2012 FI MUNI Juraj Michálek http://georgik.sinusgear.com http://twitter.com/sinusgear

×