Thread: My CG

  1. #1
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246

    My CG

    I've written this code to practice console programming and for using it as a library for the programs that may need it. I included three files. CG.cpp, its header and a tester program that uses CG functions. I am reading a beginners tutorial that told me to create this application but it used gtoxy() that was out of my reach. If you remember, I came to forum and asked about it. Forum led me to adrianxw tutorial. I learned many new functions from it. So I decided to change the whole code of CG.cpp to use windows console functions. I tried to use all Windows console capabilities to create a more efficient program, so added color support and a new delay function that could use Sleep() function in order to make delays smaller than one second in windows if needed, while keeping the compatibility with other environments. I also used events in order to get characters from user without showing them on screen. The color function will get two arguments, for foreground and background colors. The range is 0-14, if you give the fg argument greater than 14, it will not change the fg color. The tester program manual is below:

    Keys:
    'J'=Up ; 'M'=Down ; ','=Right ; 'N'=Left
    Numbers: select the color of foreground and background
    'B'=Switch to bg colors ; 'F'=Switch to fg colors
    'E'=Erase ; 'D'=Draw
    'P'=Clear screen ; 'I '=Fill screen
    'Q'=Quit

    How to use:
    Use directional keys to draw what you want. You can change foreground and background color by pressing num keys. The program is easy to work with, I think easier than reading my text.

    Please inform me about mistakes, or any idea you had.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  2. #2
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    i think everything looks really good
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  3. #3
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246

    Talking

    We should trust The Brain.
    I updated the program, take a look at this one. Some error checking and manual resizing added.
    Last edited by siavoshkc; 02-27-2006 at 05:52 PM.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Computer graphics in a movie
    By beene in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 11-22-2007, 11:08 PM
  2. Cg.
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 12-20-2002, 03:04 PM
  3. CG fantasy
    By Nutshell in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 09-28-2002, 07:39 AM
  4. Cg?
    By cozman in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 06-16-2002, 09:08 PM
  5. Japanese Cartoons VS. American Cartoons
    By Yoshi in forum A Brief History of Cprogramming.com
    Replies: 38
    Last Post: 12-21-2001, 12:53 AM