Thread: desktop character

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    18

    desktop character

    Hiya, newbie to the board - so just saying hello first off.

    Anyway, my real point in posting is to ask about the creation of a desktop character. I'm wanting to create a desktop agent (a dog) which will be free-roaming and responds intelligently when spoken to, based on the tone of voice that the user speaks in. Now I already have the emotion detection software and that's not a problem, however I'm not sure what the best way to get a free-roaming animation onto the desktop is. I've seen previous examples, and I know it is obviously possible, I want the character to be able to go anywhere on the screen and to be responsive when clicked on and manipulated with the mouse.

    So basically I'm asking if C++ is the "best" language to do this in, and how I would go about doing it?

    Thanks in advance,
    Richard.

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    C++ probably is your best bet. It's high-level enough that there are a lot of libraries to help you do things, but it's low-level enough that you're not restricted by too many security issues. As far as how - I would first suggest that you learn a bit about the Win32 API (or one of it's wrappers). Most of what you see in Windows is just default behavior, but this can be overwridden to provide a custom interface, for example, skins on Windows Media Player and similar applications. Once you've learned the basics of how all that works, you'll be in a better position to understand how to override the default behavior and make a custom character that can move about the screen. You'll also be able to recieve mouse input, etc... through the Win32 API. Behold - the joys of OOP.

    Someone in the Windows Promgramming board can give you better information than this - but this is just to get you started. I don't know how similar the code would be, but it might be worth it to take a few minutes and search this board for people who have asked how to make skins. I'm sure you'll find a link to a tutorial on the subject.

  3. #3
    Registered User
    Join Date
    Nov 2004
    Posts
    18
    Excellent, thanks for your help. I'll have a look at Win32 API stuff and creation of skins.

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You'll will need to learn how to program windows. This may be a steep learning curve if you are just starting C++. Anyway, if you need to know how to create a non-rectangular window there are two options.

    The old method is to use window regions. The primary function is SetWindowRgn(). You create a window region the shape of your sprite and hide the rest of the window.

    The new method, available on Windows 2000 and above, is transparency. You set the background color of the window to be transparent so it does not display. You can find more information on layered windows. Here is a sample of drawing text on the desktop.

    Your task is sometimes referred to as windows skinning. More information on window skinning is available.

    Here is a windows programming tutorial that may get you started.

  5. #5
    Registered User
    Join Date
    Nov 2004
    Posts
    18
    Thanks for all the links anonytmouse!
    I'm having a problem now however, I know what it is, and I know how it should be solved, but it's not happening. I've been at it for about 6 hours now, and needless to say - it's starting to really get to me.

    OK, here's the thing:

    I'm using djgpp (gcc version 3.4.3) - the newest software I could find, and RSXNTDJ 1.5.1, and trying to compile the very first file from the tutorial (test.c). The problem is that it's finding the djgpp libraries before the rsxntdj ones when it tries to compile and so i'm getting an "undefined reference to '_main'" error. Now I know this means something is wrong in the environment variables, but I've checked and checked and checked and restarted over and over, and it's just refusing to work. I've made sure that the RSXNTDJ libraries are before the DJGPP ones in the path variables, and I just cant understand why it's not working. Please tell what I'm missing!

    I've attached what i'm looking at as well in case i missed anything.

  6. #6
    Registered User
    Join Date
    Nov 2004
    Posts
    18
    I might as well include more stuff just in case anyone needs to see:

    In the file djgpp.env:
    [cpp]
    CPLUS_INCLUDE_PATH=%/>;CPLUS_INCLUDE_PATH%%DJDIR%/lang/cxx;%DJDIR%/include
    C_INCLUDE_PATH=%/>;C_INCLUDE_PATH%C:/RSXNTDJ/include;%DJDIR%/include
    OBJCPLUS_INCLUDE_PATH=%/>;OBJCPLUS_INCLUDE_PATH%%DJDIR%/include;%DJDIR%/lang/objc
    OBJC_INCLUDE_PATH=%/>;OBJC_INCLUDE_PATH%C:/RSXNTDJ/include;%DJDIR%/include;%DJDIR%/lang/objc

    [gcc]
    LIBRARY_PATH=%/>;LIBRARY_PATH%C:/RSXNTDJ/LIB;%DJDIR%/LIB
    note i put the RSXNTDJ libraries first. so it should find them first.

    Relevant environment variables:

    C_INCLUDE_PATH = %RSXNTDJ%\include\win32\anders;%RSXNTDJ%\include
    DJGPP = C:\djgpp\djgpp.env
    Path = C:\sml\bin;%SystemRoot%\system32;%SystemRoot%;%Sys temRoot%\System32\Wbem;C:\Program Files\Common Files\Ulead Systems\MPEG;C:\RSXNTDJ\BIN;"C:\djgpp\bin"
    RSXNTDJ = C:\RSXNTDJ

    Ok that should be everything relevant. Someone please help me fix this, I'm actually going crazy!

  7. #7
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Slow down there Richard. Your compiler is for DOS programs. Might I suggest MingW32 or Cygwin to meet your gcc needs for Windows? Better yet, you can download a free beta version of Microsoft Visual C++ Express 8 from m$'s site.

  8. #8
    Registered User
    Join Date
    Nov 2004
    Posts
    18
    Well I thought that as well, but in the FAQ it says it's capable of compiling Win32 programs when you add on RSXNTDJ, as long as it looks for the libraries from that first. So that's kinda why I was so determined to get it to work! I'll have a look for MingW32 and Cygwin.

  9. #9
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Dev-C++ is quite nice. It's free, a fairly small download (less than 6MB I think), uses the MinGW port of gcc, and I know it can make Win32 programs.

  10. #10
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Try www.bloodshed.net
    The Dev-C++ IDE comes with the MinGW GCC compiler.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  11. #11
    Registered User
    Join Date
    Nov 2004
    Posts
    18
    Thanks, I got Dev-C++ Version 4.9.9.0, and that seems to be running the first test.c file from the tutorial fine now. The text display program (transparency demo posted by anonytmouse) isn't working however, but I'll have a mess about with it to try to figure out why.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using a character array in a switch question.
    By bajanElf in forum C Programming
    Replies: 10
    Last Post: 11-08-2008, 08:06 AM
  2. wide character (unicode) and multi-byte character
    By George2 in forum Windows Programming
    Replies: 6
    Last Post: 05-05-2007, 12:46 AM
  3. <string> to LPCSTR? Also, character encoding: UNICODE vs ?
    By Kurisu33 in forum C++ Programming
    Replies: 7
    Last Post: 10-09-2006, 12:48 AM
  4. Character handling help
    By vandalay in forum C Programming
    Replies: 18
    Last Post: 03-29-2004, 05:32 PM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM