Post Reply 
Program template - scroller example
10-09-2016, 02:30 PM
Post: #1
Program template - scroller example
Hello,
I'm sharing here a small template I made to help building programs that need to displays graphics with scrolling.

Of course, this template have to be customized to build your own program, but it works out of the box with an example (it displays a graphic, and interact with mouse and key)

Features list :
- touchscreen horizontal and vertical scroll
- mouse click, it triggers function click(x,y) : draw a blue box in this example
- mouse double-click, it triggers function doubleclick(x,y) : draw a pink box in this example
- scroll with arrow keys (contiunous scrolling)
- enter key triggers function action() : invert screen in this example
- ESC key, to leave the program.

Important : This template use libList, download it here, you need to install it to make it work.

.hpprgm  prg_tpl2.hpprgm (Size: 10.32 KB / Downloads: 20)

For example,
To build a picture viewer program, all you have to do is to modify functions to have :
Code:

init()
BEGIN
G1:=AFiles("image.png");
END;

click(x,y) // do nothing
BEGIN
END;

doubleclick(x,y) // do nothing
BEGIN
END;

action() // do nothing
BEGIN
END;
it have never been so easier Wink

primer
Find all posts by this user
Quote this message in a reply
10-09-2016, 04:23 PM
Post: #2
RE: Program template - scroller example
Hi, I want to show an algebraic expression when given a click for exmaple

Hi, I want to show an linear algebraic expression when given a click

as I can do this?

click(x,y)
BEGIN
print(-(x+y)*5!+abs(-4)+cos(45)+ sin(π/3+π)+Σ(j,j,1,3)+√(−2)+4/3-logb(1,10);
END;
Find all posts by this user
Quote this message in a reply
10-09-2016, 07:18 PM
Post: #3
RE: Program template - scroller example
Hi,
if you use PRINT(), it will print on terminal, which is maybe not what you want.
if you want to print on the screen, you had to use TEXTOUT_P on G1.
But I don't know if it's possible to pretty print algebraic expression...

primer
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)