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 h= infoHeader.height;
int w= infoHeader.width; int w= infoHeader.width;
int components= (ret->getComponents() == -1)?3:ret->getComponents(); 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); ret->init(w,h,components);
uint8* pixels = ret->getPixels(); uint8* pixels = ret->getPixels();
for(int i=0; i<h*w*components; i+=components){ 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 components per fixel: " << cinfo.num_components << std::endl;
std::cout << "Color space: " << cinfo.jpeg_color_space << std::endl;*/ std::cout << "Color space: " << cinfo.jpeg_color_space << std::endl;*/
const int picComponents = (ret->getComponents() == -1)?cinfo.num_components:ret->getComponents(); 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); ret->init(cinfo.image_width, cinfo.image_height, picComponents);
uint8* pixels = ret->getPixels(); uint8* pixels = ret->getPixels();
//TODO: Irrlicht has some special CMYK-handling - maybe needed too? //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); png_read_image(png_ptr, row_pointers);
int fileComponents = info_ptr->rowbytes/info_ptr->width; int fileComponents = info_ptr->rowbytes/info_ptr->width;
int picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents(); 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 //Copy image
ret->init(width,height,picComponents); ret->init(width,height,picComponents);
uint8* pixels = ret->getPixels(); 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 w = fileHeader.width;
const int fileComponents= fileHeader.bitsPerPixel/8; const int fileComponents= fileHeader.bitsPerPixel/8;
const int picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents(); 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); ret->init(w,h,picComponents);
uint8* pixels = ret->getPixels(); uint8* pixels = ret->getPixels();
//read file //read file

View File

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