Thread: Size of text

  1. #16
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I'll leave that for the OP.

    Right now I'm more interested on making PDCurses working for me
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #17
    Registered User
    Join Date
    Aug 2006
    Posts
    11

    reply

    I found this on a web site, would this be the code that i could use?

    Code:
    setcolor(YELLOW); 
    settextstyle(DEFAULT_FONT, HORIZ_DIR, 2); // 2 = size 
    outtextxy(20, 320, "Press any key ... "); 
    getch();
    Code:
    // do some graphics using the WinBgi package from:
    // http://csci.biola.edu/csci105/using_winbgi.html
    //
    // for Dev-C++ you need to fix graphics2.h and WinBgi2.cpp
    // do change  unsigned int getpixel() to  int getpixel()
    // 
    // have WinBgi2.cpp in the working folder and add to project
    // have graphics2.h in the working folder
    // link with libgdi32.a
    // this Dev-C++ project is a Console Application
     
    #include <cstdio>
    #include <cmath>
    #include "graphics2.h"
     
    using namespace std;
     
    int main()
    {
     	int GraphDriver = 0, GraphMode = 0;
     	// create graph window frame
    	initgraph(&GraphDriver, &GraphMode, "", 640, 480); 
     
    	// first draw two ellipses and a line ...
      setcolor(CYAN);
    	setlinestyle(SOLID_LINE, 0, 2);  // 2 pixels wide
    	//** ellipse(int x,int y,int sa,int ea,int rx,int ry)
      //**   center = x, y 
      //**   sa = start of arc  (0 to 360 degrees)
      //**   ea = end of arc
      //**   rx = length of horizontal axis (radius)
      //**   ry = length of vertical axis (radius)
    	ellipse(320, 150, 0, 360, 150, 20);
    	
    	setcolor(LIGHTGREEN);
    	setlinestyle(SOLID_LINE, 0, 3);  // 3 pixels wide
    	ellipse(320, 150, 0, 360, 40, 90);
    	
    	setcolor(LIGHTRED);
    	setlinestyle(SOLID_LINE, 0, 2);
                 // line(int x1, int y1, int x2, int y2)
    	line(20, 300, 600, 300);
    	
    	setcolor(YELLOW);
    	settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
    	outtextxy(20, 320, "Press any key ... ");
    	getch();  // wait
     
    	// now draw some fancy lines ...
      int x, y;
    	int spokes = 6;  // triangle = 3,  more complex > 3
    	double radians;
      	
    	setcolor(GREEN);
    	radians = 360 / (spokes * 57.29578);
    	for (x = 1; x <= spokes; x++) 
      {
    		for (y = x; y <= spokes; y++) 
        {
    			line((int)(sin(y * radians) * 225 + 320),(int)(cos(y * radians) * 145 + 150),
    		  (int)(sin(x * radians) * 225 + 320),(int)(cos(x * radians) * 145 + 150));
    		}
    	}
    	outtextxy(20,320,"Press any key ... ");
    	getch();  // wait
    	
    	closegraph();
    	
      return 0;
    }

  3. #18
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Does it have graphics2.h too? (I'm interested Thanks for posting!)

  4. #19
    Registered User
    Join Date
    Aug 2006
    Posts
    11
    yes it does

  5. #20
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Em, what site did you get it from (we need graphics2.h to work it ... ), or paste the header there too

  6. #21
    Registered User
    Join Date
    Aug 2006
    Posts
    11
    Code:
    // do some graphics using the WinBgi package from:
    // http://csci.biola.edu/csci105/using_winbgi.html
    //
    // for Dev-C++ you need to fix graphics2.h and WinBgi2.cpp
    // do change  unsigned int getpixel() to  int getpixel()
    // 
    // have WinBgi2.cpp in the working folder and add to project
    // have graphics2.h in the working folder
    // link with libgdi32.a
    // this Dev-C++ project is a Console Application
    Last edited by DarkDarkDark; 08-02-2006 at 04:22 PM.

  7. #22
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    <--------------------------------------

    Nice arrow! Sometimes I need it for not seeing the obvious. It would have been better had you bolded it though I may have missed it again!

  8. #23
    Registered User
    Join Date
    Aug 2006
    Posts
    11
    I cant seem to get it to work, i keep getting errors like

    Compiler: Default compiler
    Building Makefile: "C:\Dev-Cpp\Test\Makefile.win"
    Executing make...
    make.exe -f "C:\Dev-Cpp\Test\Makefile.win" all
    g++.exe main.o -o "Project2.exe" -L"C:/Dev-Cpp/lib"

    main.o(.text+0x61):main.cpp: undefined reference to `initgraph'
    main.o(.text+0x6d):main.cpp: undefined reference to `setcolor'
    main.o(.text+0x89):main.cpp: undefined reference to `setlinestyle'
    main.o(.text+0xbd):main.cpp: undefined reference to `ellipse'
    main.o(.text+0xc9):main.cpp: undefined reference to `setcolor'
    main.o(.text+0xe5):main.cpp: undefined reference to `setlinestyle'
    main.o(.text+0x119):main.cpp: undefined reference to `ellipse'
    main.o(.text+0x125):main.cpp: undefined reference to `setcolor'
    main.o(.text+0x141):main.cpp: undefined reference to `setlinestyle'
    main.o(.text+0x165):main.cpp: undefined reference to `line'
    main.o(.text+0x171):main.cpp: undefined reference to `setcolor'
    main.o(.text+0x18d):main.cpp: undefined reference to `settextstyle'
    main.o(.text+0x1a9):main.cpp: undefined reference to `outtextxy'
    main.o(.text+0x1c1):main.cpp: undefined reference to `setcolor'
    main.o(.text+0x2f4):main.cpp: undefined reference to `line'
    main.o(.text+0x324):main.cpp: undefined reference to `outtextxy'
    main.o(.text+0x32e):main.cpp: undefined reference to `closegraph'
    collect2: ld returned 1 exit status

    make.exe: *** [Project2.exe] Error 1

    Execution terminated

  9. #24
    The Richness... Richie T's Avatar
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    469
    // link with libgdi32.a
    Might be the cause of the problem...
    No No's:
    fflush (stdin); gets (); void main ();


    Goodies:
    Example of fgets (); The FAQ, C/C++ Reference


    My Gear:
    OS - Windows XP
    IDE - MS Visual C++ 2008 Express Edition


    ASCII stupid question, get a stupid ANSI

  10. #25
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    You need to link with the lib file provided.

    Check the documentation. It will probably be called something like libbgi.a. It should be in your compiler's lib directory. The linker should have this library included.

    Edit: Richie got me
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  11. #26
    Registered User
    Join Date
    Aug 2006
    Posts
    11
    Okay then, what i should have said was, how do you link.

  12. #27
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    whats your compiler?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  13. #28
    Registered User
    Join Date
    Aug 2006
    Posts
    11
    Dev-C++ 4.9.9.2

  14. #29
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Ah... then you don't want to use that one. You have http://www.codecutter.net/tools/winbgim/ that was built specificaly for MingW.

    follow the instructions in the readme file
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. char Handling, probably typical newbie stuff
    By Neolyth in forum C Programming
    Replies: 16
    Last Post: 06-21-2009, 04:05 AM
  2. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  3. How to Change Text File Font Size
    By space in forum Windows Programming
    Replies: 3
    Last Post: 08-07-2006, 11:42 PM
  4. Text size in C
    By adminravi in forum C Programming
    Replies: 16
    Last Post: 07-19-2006, 03:13 PM
  5. Changing text size in a program
    By RedTroja in forum C++ Programming
    Replies: 3
    Last Post: 10-12-2003, 03:53 AM