Click here to Skip to main content
       

C / C++ / MFC

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
Questiongraphics.h multi-threading problemmemberyudhistira dewanata28 Dec '12 - 0:22 
AnswerRe: graphics.h multi-threading problemmvpRichard MacCutchan28 Dec '12 - 5:49 
GeneralRe: graphics.h multi-threading problemmemberyudhistira dewanata28 Dec '12 - 16:23 
I have checked the arithmetic and it works just fine if i don't multithread it.
This works just fine:
#include<graphics.h>
void drawrect(int l,int t,int r,int d,int col){
  if(col==0)setcolor(RED);
  else setcolor(BLUE);
  rectangle(l,t,r,d);
}
void drawpiece(int l,int t,int r,int d,int col){
  for(int i=1;i<5;i++)
    drawrect(i*16+l,t,i*16+r,d,col);
}
/*DWORD WINAPI Thread2(void* lparam){
  int px2=161,py2=17;
  for(int i=0;i<10;i++,py2+=16,delay(100))
    drawpiece(px2,py2,px2+16,py2+14,1);
}*/
int main()
{   
    initwindow(600,600,"TEST");   
 //   CreateThread(0,0,&Thread2,NULL,0,0);
    int px1=17,py1=17;
    for(int i=0;i<10;i++,py1+=16,delay(100))
      drawpiece(px1,py1,px1+14,py1+14,0);    
 
    int px2=161,py2=17;
    for(int i=0;i<10;i++,py2+=16,delay(100))
      drawpiece(px2,py2,px2+16,py2+14,1);
 
    getch();
    return EXIT_SUCCESS;
}
I'm really starting to think that this might be a problem from graphics.h
GeneralRe: graphics.h multi-threading problemmvpRichard MacCutchan28 Dec '12 - 23:07 
GeneralRe: graphics.h multi-threading problemmemberyudhistira dewanata30 Dec '12 - 5:01 
AnswerRe: graphics.h multi-threading problemmember Randor 29 Dec '12 - 8:25 
GeneralRe: graphics.h multi-threading problemmvpRichard MacCutchan29 Dec '12 - 21:28 
GeneralRe: graphics.h multi-threading problemmemberyudhistira dewanata30 Dec '12 - 5:30 
GeneralRe: graphics.h multi-threading problemmember Randor 31 Dec '12 - 11:14 
GeneralRe: graphics.h multi-threading problemmemberyudhistira dewanata31 Dec '12 - 16:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 24 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid