Current area: HOME ->

Zip File view

Yeakisen's Snake v1.0


This page allows you to view the contents of a file contained inside a ZIP archive available at Programmer's Heaven. This means you can view the code and find what you need from it without having to download the ZIP file first. If the file contains source code for a language we recognize, we have syntax highlighted it.

Filename displayed: YS\YSCG.pas
Found in file: 54787.zip

Download: RuleLab.Net - Web Site Biz Logic Manager 1.7.0 Web-based solution for creating expert systems and implementing business rules that will drive your web site. Consolidate your business logic in an easy to read format. Build, test, share, and deploy...
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//                            !Yeakisen's Snake!                              //
//                       Yeakisen Productions (2007)                          //
//                          Console Graphics Unit                             //
//                     Written by Matthew Gianfrancesco                       //
//                            December 11, 2007                               //
//                       Completed December 27, 2007                          //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
UNIT YSCG;

INTERFACE

TYPE
    YSImage=ARRAY[0..30,0..25]OF Byte;

CONST
    ColBlack=0;
    ColDarkBlue=1;
    ColDarkGreen=2;
    ColDarkCyan=3;
    ColDarkRed=4;
    ColDarkViolet=5;
    ColDarkYellow=6;
    ColGray=7;
    ColDarkGray=8;
    ColBlue=9;
    ColGreen=10;
    ColCyan=11;
    ColRed=12;
    ColViolet=13;
    ColYellow=14;
    ColWhite=15;
    Transparent=16;

PROCEDURE InitYSCG;
PROCEDURE ClearScreen;
PROCEDURE DrawColor(Text:Boolean;Color:Byte);
PROCEDURE DrawPixel(X,Y:Smallint);
PROCEDURE DrawImage(X,Y:Smallint;Image:YSImage);
FUNCTION LoadImage(Filename:String):YSImage;
PROCEDURE Pause(Milliseconds:Smallint);
PROCEDURE SetXY(X,Y:Smallint);

IMPLEMENTATION

USES
    Windows;

VAR
    OutputHandle:THandle;
    InputHandle:THandle;
    DrawCol:Byte;

PROCEDURE InitYSCG;
    VAR
    WindowSize:TCoord;
    WindowDraw:Small_Rect;
    InputData:TInputRecord;
    EventsRead:Cardinal;
    CursorInfo:Console_Cursor_Info;
    BEGIN
    WindowSize.X:=90;
    WindowSize.Y:=50;
    WindowDraw.Left:=0;
    WindowDraw.Top:=0;
    WindowDraw.Right:=89;
    WindowDraw.Bottom:=49;
    OutputHandle:=GetStdHandle(STD_OUTPUT_HANDLE);
    InputHandle:=GetStdHandle(STD_INPUT_HANDLE);
    GetConsoleCursorInfo(OutputHandle,CursorInfo);
    CursorInfo.bVisible:=FALSE;
    SetConsoleCursorInfo(OutputHandle,CursorInfo);
    SetConsoleScreenBufferSize(OutputHandle,WindowSize);
    SetConsoleWindowInfo(OutputHandle,TRUE,WindowDraw);
    SetConsoleTitle('Yeakisen`s Snake');
    ReadConsoleInput(InputHandle,InputData,1,EventsRead);
    DrawCol:=0;
    END;

PROCEDURE ClearScreen;
    VAR
    Coordinates:TCoord;
    CellsWritten:Cardinal;
    BEGIN
    Coordinates.X:=0;
    Coordinates.Y:=0;
    FillConsoleOutputAttribute(OutputHandle,DrawCol,4500,Coordinates,CellsWritten);
    END;

PROCEDURE DrawColor(Text:Boolean;Color:Byte);
    BEGIN
    IF(Text=FALSE)
        THEN
        DrawCol:=(Color*16)+Color
        ELSE
        SetConsoleTextAttribute(OutputHandle,Color);
    END;

PROCEDURE DrawPixel(X,Y:Smallint);
    VAR
    XCounter,YCounter:Smallint;
    Coordinates:TCoord;
    CellsWritten:Cardinal;
    BEGIN
    FOR XCounter:=0 TO 2 DO
        BEGIN
        FOR YCounter:=0 TO 1 DO
            BEGIN
            Coordinates.X:=X*3+XCounter;
            Coordinates.Y:=Y*2+YCounter;
            FillConsoleOutputAttribute(OutputHandle,DrawCol,1,Coordinates,CellsWritten);
            END;
        END;
    END;

PROCEDURE DrawImage(X,Y:Smallint;Image:YSImage);
    VAR
    XCounter,YCounter:Integer;
    OldColor:Byte;
    BEGIN
    OldColor:=DrawCol;
    FOR XCounter:=0 TO Image[30,0] DO
        BEGIN
        FOR YCounter:=0 TO Image[0,25] DO
            BEGIN
            IF NOT(Image[XCounter,YCounter]=Transparent)THEN
                BEGIN
                DrawColor(FALSE,Image[XCounter,YCounter]);
                DrawPixel(X+XCounter,Y+YCounter);
                END;
            END;
        END;
    DrawCol:=OldColor;
    END;

FUNCTION LoadImage(Filename:String):YSImage;
    VAR
    Return:YSImage;
    InFile:Text;
    XCounter,YCounter:Integer;
    BEGIN
    Assign(InFile,Filename);
    Reset(InFile);
    Readln(InFile,Return[30,0]);
    Readln(InFile,Return[0,25]);
    FOR XCounter:=0 TO Return[30,0] DO
        BEGIN
        FOR YCounter:=0 TO Return[0,25] DO
            BEGIN
            Readln(InFile,Return[XCounter,YCounter]);
            END;
        END;
    Close(InFile);
    Result:=Return;
    END;

PROCEDURE Pause(Milliseconds:Smallint);
    BEGIN
    Sleep(Milliseconds);
    END;

PROCEDURE SetXY(X,Y:Smallint);
    VAR
    CursorPos:TCoord;
    BEGIN
    CursorPos.X:=X;
    CursorPos.Y:=Y;
    SetConsoleCursorPosition(OutputHandle,CursorPos);
    END;

END.


Professional Code Generator 1.1
Java, C++ Code Generator 'Professional Code Generator' (ProCG) for the data, database and entity/com layers source code generation. Generates code for Java-JDBC, Java-BMP (Bean Managed Persiste...
Selector for MS Access 2000 2000.3.1
SELECTOR is a configurable, multi-purpose record / value selection form that can be used in your Microsoft Access application to select a record prior to opening a form, or return a value for inserti...
RuleLab.Net - Web Site Biz Logic Manager 1.7.0
Web-based solution for creating expert systems and implementing business rules that will drive your web site. Consolidate your business logic in an easy to read format. Build, test, share, and deploy...
Download Professional Code Generator 1.1 Java, C++ Code Generator 'Professional Code Generator' (ProCG)  for the data, database and entity/com layers source code  generation. Generates code for Java-JDBC, Java-BMP (Bean  Managed Persiste... Download Selector for MS Access 2000 2000.3.1 SELECTOR is a configurable, multi-purpose record / value selection form that can be used in your Microsoft Access application to select a record prior to opening a form, or return a value for inserti... Download RuleLab.Net - Web Site Biz Logic Manager 1.7.0 Web-based solution for creating expert systems and implementing business rules that will drive your web site. Consolidate your business logic in an easy to read format. Build, test, share, and deploy...







Sponsored links

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Localize software in three simple steps
Localize .Net, C/C++ & Delphi apps visually. HTML, HTML Help, XML & databases. Try Sisulizer now!
Localize Delphi software in three simple steps
Localize Delphi VCL & .Net apps visually. Plus HTML, HTML Help, XML & databases. Try Sisulizer now!
Web based bug tracking - AdminiTrack.com
AdminiTrack offers an effective web-based bug tracking system designed for professional software development teams.


Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.