[Include] od_scroll_text.inc - Make moving text in the console.
#1

PHP код:
#if defined _INC_od_scroll_text
    #endinput
#endif
#define _INC_od_scroll_text
#include <od_stdio>
#define OD_SCROLL_LEFT 0
#define OD_SCROLL_RIGHT 1
#define OD_SCROLL_BOUNCE 2
#define OD_SCROLL_Static Scroll_Static
#define OD_SCROLL_Dynamic Scroll_Dynamic
stock Scroll_Static(text[], offsetwidthprefix[] = ""suffix[] = "") {
    
IO_CarriageReturn();
    
IO_Write(prefix);
    new 
length strlen(text);
    static 
spaces[] = "                                ";
    new 
start clamp(offset0length);
    new 
end clamp(offset width0length);
    if (
offset 0) {
        new 
padding clamp(-offset0width);
        for (new 
0padding32) {
            
IO_Write(spaces[clamp(32 - (padding i), 032)]);
        }
    }
    new 
ch text[end];
    
text[end] = '\0';
    
IO_Write(text[start]);
    
text[end] = ch;
    for (new 
end offsetwidth32) {
        
IO_Write(spaces[clamp(32 - (width i), 032)]);
    }
    
IO_Write(suffix);
    
IO_Flush();
}
stock Scroll_Dynamic(text[], widthtimeprefix[] = ""suffix[] = ""direction OD_SCROLL_LEFT) {
    switch (
direction) {
        case 
OD_SCROLL_LEFT: {
            new 
end GetTickCount();
            new 
start = -width;
            new 
length strlen(text);
            for ( ; ; ) {
                for (new 
start<= length; ++i) {
                    
Scroll_Static(textiwidthprefixsuffix);
                    
end end time;
                    while (
GetTickCount() < end) {
                    }
                }
            }
        }
        case 
OD_SCROLL_RIGHT: {
            new 
end GetTickCount();
            new 
start = -width;
            new 
length strlen(text);
            for ( ; ; ) {
                for (new 
length>= start; --i) {
                    
Scroll_Static(textiwidthprefixsuffix);
                    
end end time;
                    while (
GetTickCount() < end) {
                    }
                }
            }
        }
        case 
OD_SCROLL_BOUNCE: {
            new 
end GetTickCount();
            new 
length strlen(text);
            new 
start = -(width length);
            for ( ; ; ) {
                for (new 
0>= start; --i) {
                    
Scroll_Static(textiwidthprefixsuffix);
                    
end end time;
                    while (
GetTickCount() < end) {
                    }
                }
                for (new 
start<= 0; ++i) {
                    
Scroll_Static(textiwidthprefixsuffix);
                    
end end time;
                    while (
GetTickCount() < end) {
                    }
                }
            }
        }
    }

It can make moving text in the console. Call "Scroll_Static" a lot or call "Scroll_Dynamic" once.

Hello World example:

PHP код:
#include <a_samp>
#include <od_scroll_text>
main()
{
}
public 
OnGameModeInit()
{
    
Scroll_Dynamic("hello world"50150"---:"":---");
    return 
1;



To make work on Linux type:

PHP код:
ln -/dev/tty ./scriptfiles/CON 
Uses od_stdio.inc:

http://forum.sa-mp.com/showthread.ph...22#post3812622

Password for server example:

http://forum.sa-mp.com/showthread.ph...24#post3812624

If it makes the triangle:

Reply


Messages In This Thread
od_scroll_text.inc - Make moving text in the console. - by OneDay - 13.12.2016, 08:09
Re: od_scroll_text.inc - Make moving text in the console. - by Eoussama - 13.12.2016, 08:18
Re: od_scroll_text.inc - Make moving text in the console. - by OneDay - 14.12.2016, 14:21
Re: od_scroll_text.inc - Make moving text in the console. - by Swedky - 14.12.2016, 15:05
Re: od_scroll_text.inc - Make moving text in the console. - by coool - 14.12.2016, 15:46
Re: od_scroll_text.inc - Make moving text in the console. - by ISmokezU - 14.12.2016, 15:49
Re: od_scroll_text.inc - Make moving text in the console. - by OneDay - 14.12.2016, 15:55
Re: od_scroll_text.inc - Make moving text in the console. - by ISmokezU - 14.12.2016, 17:03
Re: od_scroll_text.inc - Make moving text in the console. - by OneDay - 22.12.2016, 18:47
Re: od_scroll_text.inc - Make moving text in the console. - by OneDay - 04.04.2017, 13:16
Re: od_scroll_text.inc - Make moving text in the console. - by Jessyy - 04.04.2017, 15:43
Re: od_scroll_text.inc - Make moving text in the console. - by OneDay - 04.04.2017, 15:59
Re: od_scroll_text.inc - Make moving text in the console. - by ghostbalkan - 12.04.2017, 19:01
Re: od_scroll_text.inc - Make moving text in the console. - by OneDay - 14.04.2017, 11:07
Re: od_scroll_text.inc - Make moving text in the console. - by ghostbalkan - 15.04.2017, 11:26
Re: od_scroll_text.inc - Make moving text in the console. - by GangstaSunny. - 15.04.2017, 12:09
Re: od_scroll_text.inc - Make moving text in the console. - by OneDay - 25.04.2017, 13:13

Forum Jump:


Users browsing this thread: 2 Guest(s)