Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

draw a line

mr_biologymr_biology Member Posts: 44

I want to draw a line in 320x200 256 color mode. How to do this in Windows98 with BC++ 4.52? If someone could give me an example I would be more than grateful.

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [b][red]This message was edited by AsmGuru62 at 2002-10-16 7:47:23[/red][/b][hr]
    :
    : I want to draw a line in 320x200 256 color mode. How to do this in Windows98 with BC++ 4.52? If someone could give me an example I would be more than grateful.
    :
    [blue]You have to create the DOS program - Win32 or Win16 will not work. So, make sure your project's target is a DOS EXE:[/blue][code]
    #include
    #include
    #include

    // Set 320x200x256 mode
    _AX = 0x0013;
    geninterrupt (0x10);

    // Address in VGA at x=40pixels, y=20pixels
    unsigned uiOfs = 320*y + x;
    void* pVGA = MK_FP (0xA000, uiOfs);

    // Horizontal Line (120 pixels long):
    // Color index = 0x110
    memset (pVGA, 0x110, 120);

    // Wait for a key:
    bioskey (0);
    [/code]


  • mr_biologymr_biology Member Posts: 44

    Thanks for the example. Now, if I want to make a windows program
    is the DirectX only way to do the graphics?

  • DariusDarius Member Posts: 1,666
    :
    : Thanks for the example. Now, if I want to make a windows program
    : is the DirectX only way to do the graphics?
    :
    :
    There's DirectX and OpenGL for high performance graphics (i.e. hardware accelerated stuff). There's SDL which is a platform-independent library which is good if you quickly want low-level access to the framebuffer. You could use WinGDI, but I'd only recommend that for small quick things where speed is not important, it isn't really meant to be a graphics engine. Anyways, anyplace you'd used WinGDI you'd be better off using the graphics facilities of the GUI library you are using instead.

    "We can't do nothing and think someone else will make it right."
    -Kyoto Now, Bad Religion

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    __ [ http://forcoder.org ] free ebooks and video tutorials about || Visual Basic, PL/SQL, PHP, Python, C++, Delphi, Ruby, Perl, MATLAB, Objective-C, Visual Basic .NET, C#, JavaScript, R, Scratch, Java, C, Go, Swift, Assembly D, Awk, Bash, ML, Crystal, Apex, Lisp, Julia, VBScript, ABAP, Dart, Hack, Logo, Fortran, Prolog, Scala, LabVIEW, Rust, Kotlin, Scheme, COBOL, Lua, F#, SAS, Transact-SQL, Alice, Ada, Erlang, FoxPro, Clojure || ________

Sign In or Register to comment.