SlideShare a Scribd company logo
There is more to C

        26.11. 2012
         FI MUNI

         Juraj Michálek
http://georgik.sinusgear.com
 http://twitter.com/sinusgear
Something about me ;-)
Content

Why C rocks?




               libuv
#1 language 2012




http://www.tiobe.com
Trends
Interactive C - Robot




●   Handyboard
●   Motorola 68AX11
●   derrived from C
●   http://www.kipr.org
●   http://www.boatball.org
Portability


Linux – Windows – Mac – BSD




  http://suacommunity.com/
Clone examples


                 Available at GitHub:
  https://github.com/georgik/fimuni-c-cpp-examples



git clone git://github.com/georgik/fimuni-c-cpp-examples.git
Allegro




Allegro Low Level Game Routines
Allegro - features



keyboard, mouse, touch screen
    audio, video, graphics
        timers, events
           data files
Allegro 5.1

              Win, Lin, Mac

               iOS, Android

http://alleg.sourceforge.net/a5docs/refman/
Initialization




 al_init();
Graphic environment




al_create_display(int w, int h)
ALLEGRO_BITMAP



            Structure for bitmaps

ALLEGRO_BITMAP *bmp = create_bitmap(x,y);
Graphics



   al_putpixel(x, y, color)

   al_load_bitmap(filename);

al_draw_bitmap(bmp, 10, 10, 0);
Release memory




al_destroy_bitmap(bmp);
Keyboard



 al_install_keyboard()
al_uninstall_keyboard()


event.keyboard.keycode
Mouse



      al_install_mouse()
     al_uninstall_mouse()

al_get_mouse_state(&msestate);
Additional Allegro libraries



 Allegttf - True Type fonts support

AllegGL – HW accelerated graphics

   DUMB - audio (Vorbis/Ogg)
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
CMake – Cross Platform Make




       http://www.cmake.org
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/
Allegro – CMake - KDevelop4
Sources



Library: http://alleg.sourceforge.net

    Wiki: http://wiki.allegro.cc/
Game development community network
        http://www.allegro.cc
Simple Direct Media Layer
Init/quit



SDL_init(flags)

  SDL_quit()
Graphics



SDL_SetVideoMode(width, height,
     video_bpp, videoflags)

   Store in memory: SDL_SWSURFACE
Store on graphics card: SDL_HWSURFACE
Visual data


              SDL_Surface

  SDL_CreateRGBSurface(SDL_SWSURFACE,
width, height, 32, rmask, gmask, bmask,
                amask);
Visual data



SDL_Surface *SDL_LoadBMP(const char *file)

      Copy from one memory to another:
   SDL_BlitSurface(src, srcrect, dst,
                 dstrect);
Keyboard


SDL_PollEvent(SDL_Event *event)


     event.key.keysym.sym
Timer



         static int counter;

SDL_SetTimer(interval, tick_callback);
Mouse




SDL_GetMouseState(*x, *y);
Text

Not implemented
Extensions

                support for GL

         extension for many languages
Ada, Eiffel, Java, Lua, Perl, PHP, Pike, Python,
                      Ruby

            176 additional libraries
SDL based Libraries



 SDL_mixer – audio mixer

SDL_image – image formats

SDL_net – network support
Source




http://www.libsdl.org
Compilation



             sdl-config

      Linux, Windows, BeOS, Mac OS
gcc foo.cc -o foo `sdl-config --libs`
PyGame



Power of C and Power of Python
   http://www.pygame.org
http://nodejs.org/
Architecture of Node.js
libuv


High performance evented I/O library

     which offers the same API

       on Windows and Unix
libuv


      https://github.com/joyent/libuv



http://nikhilm.github.com/uvbook/index.html
libuv – event loop




Call callbacks   Sleep
libuv - example
Features

Filesystem

Networking

 Threads

Processes

 Utilities
TCP server example
http://www.gtk.org
GTK


                 GIMP ToolKit


C++, Guile, Perl, Python, TOM, Ada95, Objective
             C, Free Pascal, Eiffel...
Glade 3




http://glade.gnome.org
Valgrind


          debugging a profiling

               memcheck

helgrind - race condition, thread profiling
Modes debugger


   Local application

 Attach to local process

Attach to remote process

     Post-mortem
Application crashed




    Post-mortem analysis

Image from memory: coredump
Quick analysis of coredump
Strace
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
http://www.se-radio.net
EOF

        26.11. 2012
         FI MUNI

         Juraj Michálek
http://georgik.sinusgear.com
 http://twitter.com/sinusgear

More Related Content

PDF
Davide Berardi - Linux hardening and security measures against Memory corruption
PDF
Ищем уязвимости нулевого дня в ядре Linux
PDF
Debian Linux on Zynq (Xilinx ARM-SoC FPGA) Setup Flow (Vivado 2015.4)
PDF
QEMU in Cross building
PDF
Perl on embedded Linux with Buildroot‎
PDF
Embedded. What Why How
PDF
Jagan Teki - U-boot from scratch
Davide Berardi - Linux hardening and security measures against Memory corruption
Ищем уязвимости нулевого дня в ядре Linux
Debian Linux on Zynq (Xilinx ARM-SoC FPGA) Setup Flow (Vivado 2015.4)
QEMU in Cross building
Perl on embedded Linux with Buildroot‎
Embedded. What Why How
Jagan Teki - U-boot from scratch

What's hot (20)

PDF
Kernel Recipes 2013 - Crosstool-NG, a cross-toolchain generator
ODP
Android porting for dummies @droidconin 2011
PDF
Andrea Righi - Spying on the Linux kernel for fun and profit
PDF
Kernel Recipes 2013 - Conditional boot
ODT
Cross-compilation native sous android
PPTX
Build Your Own Android Tablet
PDF
syzkaller: the next gen kernel fuzzer
PDF
syzbot and the tale of million kernel bugs
PDF
Angelo Compagnucci - Upgrading buildroot based devices with swupdate
PDF
LAS16-403: GDB Linux Kernel Awareness
PDF
Intel Nervana Graph とは?
PDF
Beagleboard xm-setup
PDF
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
PDF
Jollen's Presentation: Introducing Android low-level
PDF
Talk 160920 @ Cat System Workshop
ODP
Linux kernel tracing superpowers in the cloud
PDF
Openwrt startup
PDF
The Simple Scheduler in Embedded System @ OSDC.TW 2014
PDF
pkgsrc 2013 - the record of the past year
PDF
Linux as a gaming platform, ideology aside
Kernel Recipes 2013 - Crosstool-NG, a cross-toolchain generator
Android porting for dummies @droidconin 2011
Andrea Righi - Spying on the Linux kernel for fun and profit
Kernel Recipes 2013 - Conditional boot
Cross-compilation native sous android
Build Your Own Android Tablet
syzkaller: the next gen kernel fuzzer
syzbot and the tale of million kernel bugs
Angelo Compagnucci - Upgrading buildroot based devices with swupdate
LAS16-403: GDB Linux Kernel Awareness
Intel Nervana Graph とは?
Beagleboard xm-setup
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
Jollen's Presentation: Introducing Android low-level
Talk 160920 @ Cat System Workshop
Linux kernel tracing superpowers in the cloud
Openwrt startup
The Simple Scheduler in Embedded System @ OSDC.TW 2014
pkgsrc 2013 - the record of the past year
Linux as a gaming platform, ideology aside
Ad

Similar to There is more to C (20)

ODP
Embedded Linux Multimedia
PDF
There is more to C 2013
PPT
Game programming workshop
PDF
Low Level Graphics & OpenGL
PDF
Introduction to Game programming with PyGame Part 1
PPT
01 first
ODP
SDL2 Game Development VT Code Camp 2013
PDF
The Ring programming language version 1.5.2 book - Part 47 of 181
PDF
Game Programming I - Introduction
PDF
The Ring programming language version 1.5.4 book - Part 48 of 185
PPTX
Porting the Source Engine to Linux: Valve's Lessons Learned
PDF
Game Development using SDL and the PDK
PDF
Introduction to android (and mobile) game development
PPT
Open Kode, Airplay And The New Reality Of Write Once Run Anywhere
PDF
The Ring programming language version 1.4 book - Part 14 of 30
PDF
AN INTERNSHIP REPORT ON AIRPLANE GAME MANAGEMENT SYSTEM PROJECT REPORT.
PDF
The Ring programming language version 1.6 book - Part 50 of 189
PDF
Airplane game management system project report .pdf
PDF
olibc: Another C Library optimized for Embedded Linux
PDF
Drawing Fonts
Embedded Linux Multimedia
There is more to C 2013
Game programming workshop
Low Level Graphics & OpenGL
Introduction to Game programming with PyGame Part 1
01 first
SDL2 Game Development VT Code Camp 2013
The Ring programming language version 1.5.2 book - Part 47 of 181
Game Programming I - Introduction
The Ring programming language version 1.5.4 book - Part 48 of 185
Porting the Source Engine to Linux: Valve's Lessons Learned
Game Development using SDL and the PDK
Introduction to android (and mobile) game development
Open Kode, Airplay And The New Reality Of Write Once Run Anywhere
The Ring programming language version 1.4 book - Part 14 of 30
AN INTERNSHIP REPORT ON AIRPLANE GAME MANAGEMENT SYSTEM PROJECT REPORT.
The Ring programming language version 1.6 book - Part 50 of 189
Airplane game management system project report .pdf
olibc: Another C Library optimized for Embedded Linux
Drawing Fonts
Ad

More from Juraj Michálek (20)

PDF
Rust Embedded Development on ESP32 and basics of Async with Embassy
PDF
Embedded Development on ESP32 - FEKT VUT - UREL
PDF
Embedded Rust on ESP2 - Rust Linz
PDF
How Open Source Community and Espressif made it possible to use Rust language...
PDF
C language in our world 2019
PDF
C language in our world 2017
PDF
Continuous Delivery - FIT VUT
PDF
C language in our world 2016
PDF
Story behind PF 2016
PDF
C++ and Software Engineering 2015
PDF
C language in our world 2015
PDF
C++ in our world
PDF
Bigger & Better RnD - GeeCON.cz 2014
PDF
Gradle and build systems for C language
PDF
The story behind PF2014 - Cordova
PDF
PowerShell UIAtomation
PDF
PowerShell from *nix user perspective
PDF
Ať se z kódu nepráší! 2013
PDF
Libraries and tools for C++
PDF
Git, Jenkins & Chuck
Rust Embedded Development on ESP32 and basics of Async with Embassy
Embedded Development on ESP32 - FEKT VUT - UREL
Embedded Rust on ESP2 - Rust Linz
How Open Source Community and Espressif made it possible to use Rust language...
C language in our world 2019
C language in our world 2017
Continuous Delivery - FIT VUT
C language in our world 2016
Story behind PF 2016
C++ and Software Engineering 2015
C language in our world 2015
C++ in our world
Bigger & Better RnD - GeeCON.cz 2014
Gradle and build systems for C language
The story behind PF2014 - Cordova
PowerShell UIAtomation
PowerShell from *nix user perspective
Ať se z kódu nepráší! 2013
Libraries and tools for C++
Git, Jenkins & Chuck

Recently uploaded (20)

PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Empathic Computing: Creating Shared Understanding
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
A Presentation on Artificial Intelligence
PDF
August Patch Tuesday
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Encapsulation theory and applications.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
Machine Learning_overview_presentation.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Empathic Computing: Creating Shared Understanding
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Heart disease approach using modified random forest and particle swarm optimi...
Advanced methodologies resolving dimensionality complications for autism neur...
A Presentation on Artificial Intelligence
August Patch Tuesday
Network Security Unit 5.pdf for BCA BBA.
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Diabetes mellitus diagnosis method based random forest with bat algorithm
A comparative study of natural language inference in Swahili using monolingua...
Encapsulation theory and applications.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Unlocking AI with Model Context Protocol (MCP)
OMC Textile Division Presentation 2021.pptx
Machine Learning_overview_presentation.pptx

There is more to C