ported new mouse changes by Titi to win32 (and removed debug output for image classes)

This commit is contained in:
Mark Vejvoda 2010-03-25 01:06:28 +00:00
parent bf9ebf4912
commit 2b56cfe3b0
5 changed files with 16 additions and 4 deletions

View File

@ -81,7 +81,7 @@ Pixmap2D* BMPReader::read(ifstream& in, const string& path, Pixmap2D* ret) const
int h= infoHeader.height;
int w= infoHeader.width;
int components= (ret->getComponents() == -1)?3:ret->getComponents();
std::cout << "BMP-Components: Pic: " << components << " old: " << (ret->getComponents()) << " File: " << 3 << std::endl;
//std::cout << "BMP-Components: Pic: " << components << " old: " << (ret->getComponents()) << " File: " << 3 << std::endl;
ret->init(w,h,components);
uint8* pixels = ret->getPixels();
for(int i=0; i<h*w*components; i+=components){

View File

@ -121,7 +121,7 @@ Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const
std::cout << "Color components per fixel: " << cinfo.num_components << std::endl;
std::cout << "Color space: " << cinfo.jpeg_color_space << std::endl;*/
const int picComponents = (ret->getComponents() == -1)?cinfo.num_components:ret->getComponents();
std::cout << "JPG-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << cinfo.num_components << std::endl;
//std::cout << "JPG-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << cinfo.num_components << std::endl;
ret->init(cinfo.image_width, cinfo.image_height, picComponents);
uint8* pixels = ret->getPixels();
//TODO: Irrlicht has some special CMYK-handling - maybe needed too?

View File

@ -108,7 +108,7 @@ Pixmap2D* PNGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const
png_read_image(png_ptr, row_pointers);
int fileComponents = info_ptr->rowbytes/info_ptr->width;
int picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents();
std::cout << "PNG-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << std::endl;
//std::cout << "PNG-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << std::endl;
//Copy image
ret->init(width,height,picComponents);
uint8* pixels = ret->getPixels();

View File

@ -85,7 +85,7 @@ Pixmap2D* TGAReader::read(ifstream& in, const string& path, Pixmap2D* ret) const
const int w = fileHeader.width;
const int fileComponents= fileHeader.bitsPerPixel/8;
const int picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents();
std::cout << "BMP-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << std::endl;
//std::cout << "BMP-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << std::endl;
ret->init(w,h,picComponents);
uint8* pixels = ret->getPixels();
//read file

View File

@ -35,6 +35,7 @@ int Window::nextClassName= 0;
Window::WindowMap Window::createdWindows;
unsigned int Window::lastMouseEvent = 0; /** for use in mouse hover calculations */
static int oldX=0,oldY=0;
Vec2i Window::mousePos;
MouseState Window::mouseState;
@ -68,6 +69,13 @@ Window::~Window(){
//static
bool Window::handleEvent(){
MSG msg;
POINT point;
bool ret = GetCursorPos(&point);
if(ret == true) {
oldX = point.x;
oldY = point.y;
}
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
if(msg.message==WM_QUIT){
@ -80,6 +88,10 @@ bool Window::handleEvent(){
return true;
}
void Window::revertMousePos() {
SetCursorPos(oldX, oldY);
}
string Window::getText(){
if(handle==0){
return text;