Thread: Animation using loop and pictures

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    2

    Question Animation using loop and pictures

    Hello..

    I'm quite new to the C language, but I still want to make an animation out of a certain number of images. I haven't decided the file format yet, but jpeg, raw and gif would work out fine I think.

    My question is then, how can I, in a simple way, read in an image from the harddisc and then display it in some sort of window? I dont know how this works, but I guess it is possible to read and show an image without using any additional programs?!

    Please help me
    Oh, I'm using C of course and Unix

  2. #2
    Registered User
    Join Date
    Apr 2009
    Posts
    66
    C is mainly used for CUI ( character user interface ) , for animation you must need a GUI , so I do not think that you can achieve this using C with out any compromise.

    I suggest you to prefer VC++ ,Java ,etc

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    57

    Re: Animation using loop and pictures

    I know we can read the image file contents. But I don't know we can display or not.

    For that I searched and I got his URL this can be useful for you. But If you have graphics.h then only you can use it.

    Refer: how to display a image in c - C

    I hops it will help you.

  4. #4
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    when you say 'additional programs' do you mean 'additional libraries', or actual third party software that you run independently if you dont want to use a graphics library and want to write everything yourself you will have to learn about pixel and screen formats and framebuffers to write the image data to memory, if you are not planning to write the whole thing yourself (you have said you are a beginner) then i would say use SDL, which i found very easy to get going with.
    i say very easy as i had quite a bit of programming experience before i started using it, it's not hard but if you are a raw beginner you are probably running before walking by wanting to learn animation straight off.

    Refer: how to display a image in c - C
    unfortunately this is not going to help you, unless you are using a very old compiler, though its what i started with you are probably better with modern tools from the get go
    Last edited by rogster001; 03-05-2010 at 06:50 AM.

  5. #5
    Registered User
    Join Date
    Apr 2009
    Posts
    66
    Im totally agree with rogster001 , since you are a beginner it is difficult you to design this animation stuffs.
    so it is better you to use Simple DirectMadia Layer ( SDL ). SDL is a free and open source multimedia library.and aslo supports cross platform.

  6. #6
    Registered User
    Join Date
    Mar 2010
    Posts
    2

    Thanks...

    You guys helped me alot. I've been searching the internett for quite a while without any results, and then you come along and answeres me right away.

    "C is mainly used for CUI ( character user interface ) , for animation you must need a GUI , so I do not think that you can achieve this using C with out any compromise."

    I had a hunch of this, but now I know for shore. thanks.

    To rogster001 and Alexander jack; I wanted to make an animation from the bottom of, but since it probably is to hard for me then I let it go.. I've been looking on SDL now and it looks good. Since you recommend it I'll give it a try. Thanks again!

    By additional program I actually ment program like SDL, GLwiew(If you've heard of that), and not extra libraries.

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by mortehau View Post
    "C is mainly used for CUI ( character user interface ) , for animation you must need a GUI , so I do not think that you can achieve this using C with out any compromise."

    I had a hunch of this, but now I know for shore. thanks.
    This is not true. There are many commerical and free programs in C with a GUI (and C++ too for that matter).
    That may be a little harder to make a GUI in (C more so than C++), but that doesn't mean they cannot be used for GUI programs, or that they are not used for GUI programs.
    Pay no heed to that. If you want to write a GUI in C, you can do it. Though it might be easier if you chose another language.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Registered User UltraKing227's Avatar
    Join Date
    Jan 2010
    Location
    USA, New york
    Posts
    123
    I never use C++ for GUI programming...
    althrough, i prefer to program C GUI applications on windows. the concept
    of programming Unix GUI is nearly the same, anyway SDL is a good choice.

  9. #9
    Registered User
    Join Date
    Jan 2008
    Posts
    28
    @mortehau

    I would recommend setting it as your future goal instead of your present task.

    Start from the ground up with the language. This site has an awesome set of tutorials that will surely help you learn, and if you get stuck you can ALWAYS come to the forums and ask for assistance.

  10. #10
    Or working on it anyways mramazing's Avatar
    Join Date
    Dec 2005
    Location
    Lehi, UT
    Posts
    121
    Allegro will work. It is a game programming library analogous to SDL. I found that it was a bit easier to learn when I first started but that could change from person to person. Allegro will let you 'load_bitmap()' which can be use for jpegs and gifs i believe, then blit the image to the screen. using a loop you can get an animation. Hope that helps

    link:
    Allegro - A game programming library
    -- Will you show me how to c++?

Popular pages Recent additions subscribe to a feed