Up

Warm up ViSaGe

a program in Visual C++/CLR

 

A program to warm up ViSaGe can be down loaded.

This program is written in Visual C++/CLR and files in the solution are packed into WarmUp.ZIP.

Unpacked files can be opened by Visual C++2008.

Before building the project, VSGV8.LIB should be replaced by that in the appropriate folder in your PC system, if necessary.

When the program is running, a white line is running on your display.

–³‘è.jpg

Part of the program is as follows:

=======================================================================

        int h, w, LnPos, IDState;

 

        private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {

                                 ::vsgInit("");

                                 ::vsgSetCommand( vsgPALETTECLEAR );

                                 ::vsgSetDrawMode( vsgCENTREXY + vsgANTIALIASED );

 

                                 h = ::vsgGetScreenHeightPixels();

                                 w = ::vsgGetScreenWidthPixels();

                                 ::vsgSetDrawPage( vsgVIDEOPAGE, 0, 0 );

 

                                 ::VSGTRIVAL vsgCLWhite, vsgCLBlack;

                                 vsgCLWhite.a = 1.0;

                                 vsgCLWhite.b = 1.0;

                                 vsgCLWhite.c = 1.0;

                                 ::vsgPaletteSet( 255, 255, &vsgCLWhite );

 

                                 vsgCLBlack.a = 0.0;

                                 vsgCLBlack.b = 0.0;

                                 vsgCLBlack.c = 0.0;

                                 ::vsgPaletteSet( 1, 1, &vsgCLBlack );

 

                                 ::vsgSetDisplayPage( 0 );

                                 ::vsgSetPen1( 255 );

                                 ::vsgDrawRect( 0, 0, w, h );

 

                                 ::vsgSetPenSize( 1, 1 );

                                 ::vsgSetDrawMode( vsgSOLIDPEN + vsgCENTREXY );

 

                                 LnPos = 0;

                                 IDState = 0;

                                 timer1->Interval = 20;

                                 timer1->Enabled = true;

                         }

 

         void Proc0(){

                 ::vsgSetPen1( 1 );

                 ::vsgDrawLine( -w/2 + 1.0, -h/2 + LnPos, w/2, -h/2 + LnPos );

                 LnPos++;

                 if (LnPos > h - 1){

                        LnPos = 0;

                        IDState = 1;

                        return;

                 }

                 ::vsgSetPen1( 255 );

                 ::vsgDrawLine( -w/2 + 1.0, -h/2 + LnPos, w/2, -h/2 + LnPos );

         }

 

        void Proc1(){

                 ::vsgSetPen1( 1 );

                 ::vsgDrawLine( -w/2 + 1.0 + LnPos, -h/2, -w/2 + 1.0 + LnPos, h/2 );

                 LnPos++;

                 if (LnPos > w - 2){

                        LnPos = 0;

                        IDState = 2;

                        return;

                 }

                 ::vsgSetPen1( 255 );

                 ::vsgDrawLine( -w/2 + 1.0 + LnPos, -h/2, -w/2 + 1.0 + LnPos, h/2 );

         }

 

         void Proc2(){

                 ::vsgSetPen1( 1 );

                 ::vsgDrawLine( w/2 - 1.0, h/2 -1.0 - LnPos, -w/2, h/2 -1.0 - LnPos );

                 LnPos++;

                 if (LnPos > h - 1){

                        LnPos = 0;

                        IDState = 3;

                        return;

                 }

                 ::vsgSetPen1( 255 );

                 ::vsgDrawLine( w/2 - 1.0, h/2 -1.0 - LnPos, -w/2, h/2 -1.0 - LnPos );

         }

 

        void Proc3(){

                 ::vsgSetPen1( 1 );

                 ::vsgDrawLine( w/2 - 1.0 - LnPos, -h/2, w/2 - 1.0 - LnPos, h/2 );

                 LnPos++;

                 if (LnPos > w - 2){

                        LnPos = 0;

                        IDState = 0;

                        return;

                 }

                 ::vsgSetPen1( 255 );

                 ::vsgDrawLine( w/2 - 1.0 - LnPos, -h/2, w/2 - 1.0 - LnPos, h/2 );

         }

 

        private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {

                                 timer1->Enabled = false;

                                 switch (IDState){

                                                case 0 :        Proc0(); break;

                                                case 1 :        Proc1(); break;

                                                case 2 :        Proc2(); break;

                                                case 3 :        Proc3(); break;

                                                default :       break;

                                 }

                                 timer1->Enabled = true;

                         }

       

        private: System::Void buttonQuit_Click(System::Object^  sender, System::EventArgs^  e) {

                                 ::vsgInit("");

                                 Close();

                         }

 

When you write your codes for ViSaGe in Visual C++, IntelliSense would provide dynamic assistance if you use scope resolution operator such as in g::vsgch.

 

Up