금요일, 5월 22, 2015

How to use SDL2, SDL2_Mixer on Cygwin Guide

You can use precompiled win32 libraries SDL, SDL2, SDL_mixer and SDL2_mixer
for compiling with your project on Cygwin the way below.

// --------------------------------------------------------
// Project:
// Purpose: How to use SDL2, SDL2_Mixer on Cygwin Guide
// Author: Ho-Jung Kim (godmode2k@hotmail.com)
// Date: May 22, 2015
// Filename: SDL2, SDL2_Mixer on Cygwin.txt
// --------------------------------------------------------
// NOTE:
// --------------------------------------------------------



// --------------------------------------------------------
// Prerequisites (My environment)
// --------------------------------------------------------

 - SDL2-devel-2.0.3-mingw.tar.gz
 - SDL2_mixer-devel-2.0.0-mingw.tar.gz

You can download SDL, SDL_mixer at
http://www.libsdl.org/ and http://www.libsdl.org/projects/SDL_mixer/

 - Cygwin: Any version with build essentials all
    (My env: CYGWIN_NT-6.1-WOW64 xxx 1.7.28(0.271/5/3) xxx i686 Cygwin)

http://www.cygwin.com/



// --------------------------------------------------------
// Library home directory
// --------------------------------------------------------

* Create a directory '/sdl_lib'
* Extract the libraries
* Rename the directories


/sdl_lib

/sdl_lib/SDL2-2.0.3
 - SDL2-devel-2.0.3-mingw.tar.gz
/sdl_lib/SDL2_mixer-2.0.0
 - SDL2_mixer-devel-2.0.0-mingw.tar.gz



We will use the path ".../i686-w64-mingw32/..."

// SDL2 library
/sdl_lib/SDL2-2.0.3/i686-w64-mingw32
/sdl_lib/SDL2-2.0.3/include
/sdl_lib/SDL2-2.0.3/lib


// SDL2_mixer library
/sdl_lib/SDL2_mixer-2.0.0/i686-w64-mingw32



// --------------------------------------------------------
// Win32 Runtime
// --------------------------------------------------------

// SDL2
/sdl_lib/SDL2-2.0.3/lib/{x86|x64}/SDL2.dll

// SDL2_mixer
/sdl_lib/SDL2_mixer-2.0.0/i686-w64-mingw32/bin/SDL2_mixer.dll



// --------------------------------------------------------
// Compile
// --------------------------------------------------------

// Copy all of static libraries (archive .a) and dlls to '/sdl_lib'

// SDL2
COPY: /sdl_lib/SDL2-2.0.3/i686-w64-mingw32/bin/SDL2.dll
      -> /sdl_lib
COPY: /sdl_lib/SDL2-2.0.3/i686-w64-mingw32/lib/*.a
      -> /sdl_lib
COPY: /sdl_lib/SDL2-2.0.3/lib/{x86|x64}/*.lib (NO SDL2.dll)
      -> /sdl_lib

// SDL2_mixer
COPY: /sdl_lib/SDL2_mixer-2.0.0/i686-w64-mingw32/bin/*.dll
      -> /sdl_lib
COPY: /sdl_lib/SDL2_mixer-2.0.0/i686-w64-mingw32/lib/*.a
      -> /sdl_lib



// GCC options

// Header path
-I/sdl_lib/SDL2-2.0.3/i686-w64-mingw32/include
-I/sdl_lib/SDL2-2.0.3/include
-I/sdl_lib/SDL2_mixer-2.0.0/i686-w64-mingw32/include

// Library path
// - Use below lib path or -L/sdl_lib
-L/sdl_lib/SDL2-2.0.3/i686-w64-mingw32/lib
-L/sdl_lib/SDL2-2.0.3/i686-w64-mingw32/bin
-L/sdl_lib/SDL2-2.0.3/lib/{x86|x64}
-L/sdl_lib/SDL2_mixer-2.0.0/i686-w64-mingw32/lib
-L/sdl_lib/SDL2_mixer-2.0.0/i686-w64-mingw32/bin

// Linking
-lSDL2main -lSDL2 -lSDL2_mixer





done.



__EOF__

화요일, 2월 10, 2015

GTK+ Examples: GtkDrawingArea, Cairo, Pango Text, Font, Image, ...

GTK+ Examples: GtkDrawingArea, Cairo, Pango Text, Font, Image, ...

GTK+ Examples
https://github.com/godmode2k/gtk_examples

GTK+ Font dialog(gtk_font_selection_dialog), Color Dialog(gtk_color_selection_dialog),
Popup Dialog(gtk_menu_shell), GtkDrawingArea, Cairo/Pango image, text, font handling,
image load, scaling, rotation, client region capture, etc.

Summary
----------
> The sources show you how to use a GtkDrawingArea,
> make a custom View and how to use Cairo/Pango font glyph.


Environment
----------
> build all and tested on GNU/Linux X-Window

    GNU/Linux: Ubuntu 11.10 (Unity 3D, 2D)
    GTK+ version: 2.x, 3.x
    Cairo version: 1.xx
    Pango version: 1.0


Build
----------
> as following or you should make whatever you want

    ./atp3/
     - build.sh                // for build all
-
     - atp3.cpp                // Main Class
-
- CBaseView.cpp           // Abstract Base View Class
- CKeyEvent.cpp           // Key, Mouse Event Base Class
-
- CViewMain.cpp           // Main View Class
- CViewAttach.cpp         // Attachment (Text, Image) Class
-
- incl_g_func.cxx                   // Global functions
- incl_g_func_signal_handler.cxx    // Gtk+ Widget Signal Handler
- incl_progress_dlg.cxx             // Progress Dialog Implements
- incl_toastmsg_dlg.cxx             // Toast Message Dialog Implements
-
- ui_gtk2.glade           // Glade UI(XML) for GTK+2.x
- ui_gtk3.glade           // Glade UI(XML) for GTK+3.x
- ui_glade.h              // Glade UI(XML) to C-Style include file, AUTO-GENERATED at build


./libs/util
 - CMutexSemaphore.h      // Mutex, Semaphore Class (Abstract)
 - CNetSockLib.cpp        // Network Class
 -
 - CDialog.cpp            // Gtk+ Widget Dialog Class (Custom)
 - CThreadTask.cpp        // PThread Class, like AsyncTask method in Android
 - CProgressDlg.cpp       // Progress Dialog Class
 - CToastMsgDlg.cpp       // Message Dialog Class, like Toast method in Android
 -
 - CUtil.cpp              // Useful system functions (utility)


    $ sh build.sh atp3 atp3.cpp
    $ ./atp3


Screenshots
----------

> Image & Text


> Popup menu


> Text Dialog


> Text Dialog: Font


> Text Dialog: Color


> Toast Message Dialog (Ubuntu Unity 2D, No Alpha effect)


> Toast Message Dialog (Ubuntu Unity 3D, Alpha effect applied)


> Progress Dialog


> Capture region


> Rotation
















-----
Cheers,
June