Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

zaawansowane menu w konsoli

Ostatnio zmodyfikowano 2008-12-29 13:22
Autor Wiadomość
pekfos
Temat założony przez niniejszego użytkownika
» 2008-12-28 20:54:25
już rozumiem jak tam to działa :) narazie napisałem coś takiego:
C/C++
#include <iostream>
#include <conio.h>
#include <console.ddt>
using namespace std;
using namespace ddt::console;
int main()
{
   
    int znak = 0;
    int position = 1;
    bool entry = false;
    const int pod = 10;
    const int min = 1;
    const int max = 2;
    const string op1 = "nothing";
    const string op2 = "exit";
    const int op = 7;
    const int po = 0;
   
    do
    {
        if( position == min )
        {
            textbackground( op );
            for( int a = 0; a < pod; a++ ) cout << " ";
           
            gotoxy( wherex() - pod, wherey() );
            textcolor( po );
            cout << op1 << endl;
            textbackground( po );
            textcolor( op );
            cout << op2 << endl;
        }
        if( position == max )
        {
            textcolor( op );
            textbackground( po );
            cout << op1 << endl;
            textbackground( op );
            for( int a = 0; a < pod; a++ ) cout << " ";
           
            gotoxy( wherex() - pod, wherey() );
            textcolor( po );
            cout << op2 << endl;
            textbackground( po );
            textcolor( op );
        }
       
        znak = getch();
        clrscr();
        switch( znak )
        {
        case 224:
            break;
        case 72:
            if( position > min ) position--;
           
            break;
        case 80:
            if( position < max ) position++;
           
            break;
        case 13:
            entry = true;
            break;
        }
       
        if( entry )
        {
            if( position == min );
           
            if( position == max ) return 0;
           
            entry = false;
        }
       
    }
    while( 2 == 2 );
   
    return 0;
}
P-3054
pekfos
Temat założony przez niniejszego użytkownika
» 2008-12-29 13:22:11
napisałem jeszcze ułatwienie tego sposobu:
C/C++
#include <iostream>
#include <conio.h>
#include <console.ddt>
using namespace std;
using namespace ddt::console;

void zrobokno( int wys, int sz, int x, int y, int txk, int bck )
{
    gotoxy( x, y );
    textcolor( txk );
    textbackground( bck );
    for( int a = 0; a < wys; a++ )
    {
        for( int b = 0; b < sz; b++ ) cout << " ";
       
        gotoxy( x, y + a + 1 );
    }
    gotoxy( x, y );
}

void zroboknoex( const string tx, int x, int y, int dl, int txk, int bck )
{
    gotoxy( x, y );
    textcolor( txk );
    textbackground( bck );
    for( int a = 0; a < dl; a++ ) cout << " ";
   
    gotoxy( x, y );
    cout << tx;
}

int main()
{
    zrobokno( 5, 10, 6, 7, 0, 2 );
    zroboknoex( "tekst", 8, 20, 10, 0, 1 );
    getch();
    return 0;
}
funkcja zrobokno przyjmuje 6 parametrów:
wysokość, szerokość okna, współrzędne x i y lewego górnego rogu okna, kolor tekstu i kolor tła a funkcja zroboknoex też przyjmuje 6 parametrów :) :
napis w oknie, współrzędne x i y lewego górnego rogu okna, długość okna, kolor tekstu i tła :)
P-3063
1 2 « 3 »
Poprzednia strona Strona 3 z 3