Assistance on C++ program

Hi, how to make a running text that starts from left to right, and also from up to down? I need it because I'm doing a project and the design needs a running text like a billboard advertisement style. If possible, please attach any sample code of how it works. Thank you so much.
So, you demand others do all the work, for free.

Nope, not gonna happen.

You write code that you believe does the work, post it here, and we'll give feedback.
This will require a graphical display. Since the C++ standard doesn't define such things, you need to tell us what platform you're working on.

The general idea is pretty simple. You start with the bitmap of the text. At regular time intervals, you shave off some number of pixels from the left edge of the bitmap, put the result into a new bitmap and replace the display with the new bitmap. The image is actually moving across in discreet little jumps, but the human brain interprets it as smooth motion.

Up and down motion is achieved the same way, but your shaving from the top of the image instead of the left.
This MIGHT work in Windows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
#include <string>
#include <thread>
#include <chrono>
#include <algorithm>
#include <cstdlib>
#include <windows.h>
using namespace std;

HANDLE h = GetStdHandle( STD_OUTPUT_HANDLE );

//======================================

void gotoxy( int x, int y )
{
   COORD c = { x, y };
   SetConsoleCursorPosition( h, c );
}

//======================================

void delay( unsigned int msecs )
{
   this_thread::sleep_for( chrono::milliseconds( msecs ) );
}

//======================================

void writeHorizontal( int x0, int y0, string s )
{
   gotoxy( x0, y0 );
   cout << s;
}

//======================================

void writeVertical( int x0, int y0, string s )
{
   for ( char c : s ) 
   {
      gotoxy( x0, y0++ );
      cout << c;
   }
}

//======================================

int main()
{
   string headline = "  And on the sixth day God created Manchester   ";
   system( "cls" );
   while( true )
   {
      writeHorizontal( 10, 0, headline );
      writeVertical( 0, 0, headline );
      rotate( headline.begin(), headline.begin() + 1, headline.end() );
      delay( 300 );
   }
}
Last edited on
all advertising software should start with
exit(0);
An easy way to do this with simple graphics is to put all the text on a texture, apply it to some sort of looped geometry that does not distort it (visibly) in the field of view and set it rotating. But only do this after the exit(0) or it will not work right.
Last edited on
Topic archived. No new replies allowed.