Closed Thread
Results 1 to 6 of 6

Thread: Need help inmediatly

  1. #1
    -hetsteve- is offline Newbie
    Join Date
    Dec 2008
    Posts
    4
    Rep Power
    0

    Need help inmediatly

    I have programmed some kind of code.
    But maybe this is a very simple question but i am stucked.

    I want to display the text area of test you will later see in my code.

    I want that in my classes TextBox, paragraph DISPLAY that he shows the ARRAYS that i have make for Textboxes.

    CAN ANYBODY HELP ME!
    Here is my code:
    Code:
    Screen screen1, screen2;
      Image[] _Images;
      ImageButton[] _ImageButtons;
      TextBox[] _TextBoxes;
      TextBoxButton[] _TextBoxButtons;
      String _Sound;
      PFont fontA;
    
    Screen current_screen;
      
    void setup()
    {
      size(800,600);
      smooth();
      background(255);
      /* ------------------------------Edit from here---------------------*/
      
      // Images for screen 1
      _Images = new Image[2]; // 2: How many Images are used in this screen
      _Images[0] = new Image("image1.jpg", 0, 0); // First image for screen 1 is image1.jpg placed on 0 pixels X and 0 pixels Y
      _Images[1] = new Image("image2.jpg", 100, 100);
      // ImageButtons for screen 1
      _ImageButtons = new ImageButton[1]; // 1: How many ImageButtons are used in this screen
      _ImageButtons[0] = new ImageButton("image1.jpg", 0, 0, screen2); // First image links to screen 2 (doesn't work YET)
      // Textboxes for screen 1
      _TextBoxes = new TextBox[1];
      _TextBoxes[0] = new TextBox("Test", 200, 200); // First textbox placed on X,Y(200,200) with the text "Test"
      // TextboxButtons for screen 1
      _TextBoxButtons = new TextBoxButton[1];
      _TextBoxButtons[0] = new TextBoxButton("TestLink", 300, 300, screen2);
      // Set sound for screen 1
      _Sound = "sound.mp3";
      
      // Finally Set Screen 1
      screen1 = new Screen(_Images, _ImageButtons, _TextBoxes, _TextBoxButtons, _Sound);
      
      /* ----------------------------Do not edit from here--------------*/
      
      current_screen = screen1;
    }
    void draw()
    {
      DisplayScreen();
    }
    
    class Screen
    {
      Image[] Images;
      TextBox[] TextBoxes;
    
      Screen(Image[] _Images, ImageButton[] _ImageButtons, TextBox[] _TextBoxes, TextBoxButton[] _TextBoxButtons, String _Sound)
      {
         Images = _Images;
         TextBoxes = _TextBoxes; 
      }
      void set()
      {
        
      }
      void display()
      {
         for(int i=0; i < Images.length; i++){
           Images[i].display();
         }
      }
    }
    class Image
    {
      int x, y;
      String file;
      Image(String ifile, int ix, int iy) {
        x = ix;
        y = iy;
        file = ifile;
      }
      void display() {
        PImage loadimage = loadImage("Images/" + file);
        image(loadimage, x, y);
      }
      
    }
    class ImageButton
    {
      int x, y;
      String file;
      Screen screen;
      
      ImageButton(String _file, int _x, int _y, Screen _screen) {
        x = _x;
        y = _y;
        file = _file;
        screen = _screen;
      }
      void display() {
        PImage loadimage = loadImage("Images/" + file);
        image(loadimage, x, y);
      }
      // void to link Button to Screen
    }
    class TextBox
    {
      int x, y;
      String text;
      
      TextBox(String _text, int _x, int _y) {
        x = _x;
        y = _y;
        text = _text;
      }
      void display() {
        String text;
        fontA = loadFont("AgencyFB-Bold-48.vlw");
        textFont(fontA);
        fill(0);
        
      }
    }
    class TextBoxButton
    {
      int x, y;
      String text;
      Screen screen;
      
      TextBoxButton(String _text, int _x, int _y, Screen _screen) {
        x = _x;
        y = _y;
        text = _text;
        screen = _screen;
      }
      void display() {
        // code to display textbox
      }
      // void to link Button to Screen
    }
    void DisplayScreen(){
      current_screen.display();
    }
    Last edited by WingedPanther; 12-28-2008 at 04:00 PM. Reason: add code tags (the # button)

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Chinmoy's Avatar
    Chinmoy is offline Programming Expert
    Join Date
    Feb 2008
    Location
    where heaven meets earth
    Posts
    410
    Rep Power
    18

    Re: Need help inmediatly

    your problem is not clear!!
    God is real... unless declared an integer

  4. #3
    -hetsteve- is offline Newbie
    Join Date
    Dec 2008
    Posts
    4
    Rep Power
    0

    Re: Need help inmediatly

    Quote Originally Posted by Chinmoy View Post
    your problem is not clear!!
    Oke, I will explain

    If i run this application you will see 2 images.
    Image 1 and Image 2.
    I display the image by using Arrays and by using a CLass Image.

    But know i have made an array of TextBoxes.
    And i want to display the textbox with the text "test"
    So i have to call this in the class TextBox in the display i think.

    I want that when the programm reads the class TextBox that he refers to the array of new TextBox.

    I hope it is now clear enough.

  5. #4
    -hetsteve- is offline Newbie
    Join Date
    Dec 2008
    Posts
    4
    Rep Power
    0

    Re: Need help inmediatly

    The problem Basicly is that i don't even see any text or any textboxes in the screen.
    I want to display the textbox by the class Textbox with the array that i have made in the upper code. like new TextBox = TextBoxes[1].

    I want to see the text with the textbox inside the class.

  6. #5
    Join Date
    May 2008
    Location
    Hell
    Posts
    3,851
    Blog Entries
    4
    Rep Power
    49

    Re: Need help inmediatly

    Quote Originally Posted by -hetsteve- View Post
    The problem Basicly is that i don't even see any text or any textboxes in the screen.
    I want to display the textbox by the class Textbox with the array that i have made in the upper code. like new TextBox = TextBoxes[1].

    I want to see the text with the textbox inside the class.
    I will give it a check and see if there is something I can contribute to you...

    EDIT - this code seems bloated and kinda hard to see since you have things I can't reach within my own package. Do you use any external files/data/or w/e?

  7. #6
    -hetsteve- is offline Newbie
    Join Date
    Dec 2008
    Posts
    4
    Rep Power
    0

    Re: Need help inmediatly

    Quote Originally Posted by Turk4n View Post
    I will give it a check and see if there is something I can contribute to you...

    EDIT - this code seems bloated and kinda hard to see since you have things I can't reach within my own package. Do you use any external files/data/or w/e?
    yeah that could be
    but it is made with PROCESSING , but proccessing use javascript and java so that's why you could download the free version of Processing on processing.org

    but i hope you can help
    or otherwise how should you do it?? in the orginally java language??

    Thanks

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts