MetkuMods



OLED-teknologiaa
4D Systemsiltä


 
Kirjoittaja: Aki Korhonen
Julkaistu: 25.06.2009
Valmistaja: 4D Systems
In English In English
Suomeksi Suomeksi

OLED Paint - Kosketuspintaa käyttävä piirtelyohjelma

Testattavana oleva moduuli on varustettu kosketuspaneelilla, joten tässä pieni 4DGL:llä tehty piirtelyohjelma, joka käyttää kielen tarjoamia kosketusnäyttöfunktioita. 4DGL sisältää tätä varten funktiot näytön tilan (painettu/vedetty/päästetty) ja X+Y koordinaattien kyselyyn.

Ohjelma on tehty yksinkertaisesti niin, että se vaan hakee X ja Y koordinaatteja kosketuspinnalta ja piirtää täplän siihen kohtaan. Koska näyttöä ei tyhjennetä täplien piirron välissä, jää kuva näytölle ja kuvioita voidaan tehdä. Näytön tyhjentämiseen on alareunassa pieni painike. Koodissa oleva fix_coordinates -funktio on vaan nopeasti kasattu X ja Y -koordinaattien korjausta varten, jotta piirrettävä täplä pysyy koko ajan kynän kärjen kohdalla. Ilman korjausta täplän kohdistuksessa alkaa tulla heittoa reunojen lähestyessä.

 

Introcution to 4D Systems OLED Technology
OLED Paint

Alla on video ohjelmasta toiminnassaan:

Get Flash to see this player.

Koodi:

#platform "uOLED-32024-P1T"

/*************************************************
* MetkuMods - /
*
* Filename: drawing_program_2.4dg
* Created: 2009/06/11
* Author: Aki Korhonen
* Description: Simple drawing program
**************************************************/

#inherit "4DGL_16bitColours.fnc"

var x, y, state;
var x2, y2;

func fix_coordinates()
    if(x < 81)
        x2 := (((810-x*10)/81) * 20)/10;
        x := x + x2;
    else
        x2 := (((1590-(1590-(x*10-810)))/159) * 30)/10;
        x := x - x2;
    endif
    
    if(y < 172)
        y2 := (((1720-y*10)/172) * 20)/10;
        y := y + y2;
    else
        y2 := (((1480-(1480-(y*10-810)))/148) * 30)/10 - 18;
        y := y - y2;
    endif
endfunc

func main()
    gfx_Cls();
    
    touch_Set(TOUCH_ENABLE);
    
    while(1)
        gfx_Set(PEN_SIZE, 1); 
        gfx_Rectangle(20, 20, 220, 280, BLUE);
        
        gfx_Button(UP, 55, 280, GRAY, BLACK, FONT1, 4, 1, "CLEAR");
        
        txt_MoveCursor(0, 5);
        print("OLED Paint");
        
        state := touch_Get(TOUCH_STATUS);
        x := touch_Get(TOUCH_GETX);
        y := touch_Get(TOUCH_GETY);
        
        fix_coordinates();
        
        if(55 < x && x < 185 && 280 < y && y < 300)
            pause(100);
            gfx_Set(PEN_SIZE, 0); 
            gfx_Rectangle(21, 21, 219, 279, BLACK);
        else
            gfx_Set(PEN_SIZE, 0); 
            gfx_Circle(x, y, 1, WHITE);
        endif
    wend
endfunc







Sivut:   1 2 3 4 5 6 7 8 9 10 11 12 



 
  Content in english!
  Sisältö suomeksi!


 Google





 .:Back to top Bandwidth by Mpoli

Copyright © Metku.net, All Rights Reserved.
All content and graphics in MetkuMods are sole property of Jani Pönkkö and may not be reproduced or copied in any manner without written permission from him.
All brand names, trademarks and copyrights are the property of their respective owners.Privacy Policy