All pastes #926186 Raw Edit

Untitled

public text v1 · immutable
·published 2008-03-03 16:31 UTC
rendered paste body
#include <sstream>
#include "weather.h"
#include "settings.h"


using namespace std;

weather::weather()
{
    //weather_info.setLocationID("21228");
    //weather_info.setFilename("/tmp/weather.xml");
    //for testing set interval to 1 min
    //weather_info.setInterval(1);
    //weather_info.update();
}

#ifdef OPENGL
int weather::init(std::string fn, std::string n, gfxengine_opengl *g, int x ,int y)
#else
int weather::init(std::string fn, std::string n, gfxengine_sdl *g,int x ,int y)
#endif
{
    name=n;
    _init(g);

    images_path = getOption("skin");
    images_path = get_skin_dir("nghost", images_path);
    images_path += "screens/images/weather/";

    offset = 15;
    int text_offsetx = 95;
    int text_offsety = 50;
    int code = 44;
    ostringstream path;

    /*
    image * myimage;

    for(int i=0; i < 3; i++){
        myimage = new image;
        myimage->init(gfx);
        int r = myimage->loadImage(images_path, "weather"+i , 10, 50 );
        std:: cout << "[ loading image r: " << r <<" ]\n" ;
        images.push_back(myimage);
    }
    */

    //gfx->setScale(false);
    //
    //Location text
    TextClass *t = new TextClass;
    t->init(g,get_skin_dir("nghost", getOption("skin")) ,"25,200,200,200");

    ostringstream temp_str;
    //temp_str << weather_info.getLocation().city <<  ", " << weather_info.getLocation().region;

    //t->setText(temp_str.str());    
    t->setText("Location: te");
    //t->move(x+offset+text_offsetx, y+offset+text_offsety);
    t->move(x,y );
    text.push_back(t);

    cout << "[ x: " << x << " y: " << y << " ]\n";

   
    cout << "[ filename: " << fn << " ] " << endl;
    return loadImage(fn,name,x,y);
}

void weather::clear(){
	name="";
}

void weather::draw(){


}

void weather::display(){


  	_display();


	//Diplay images
	//current->display();
	/*
	for(int i=0; i < forecast.size(); i++){
		forecast[i]->display();
	}

        */
	
        //display text
	for(int i=0; i < text.size(); i++){
		text[i]->display();
	}
	
}