ShowStimBox.m 1.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
function stimBoxParam = ShowStimBox(wPtr, deckParam, imageDir, modelCommID, deckColors)
    screenSize = Screen('Resolution', wPtr);
    
    %disp('In ShowStimBox');
    
    posX = deckParam(1);
    posY = deckParam(2);
    cardWidth = deckParam(3);
    cardHeight = deckParam(4);
    
    stimWidth = screenSize.width * 0.3;
    stimHeight =  screenSize.height * 0.3;
    stimPosX = (screenSize.width/2)-(stimWidth/2);
    stimPosY = posY+(cardHeight*1.5);
    
    stimBox = imread(fullfile(imageDir, 'rewBG.png'), 'PNG');
    stimBox = rgb2gray(stimBox);
    stimBoxTex = Screen('MakeTexture', wPtr, double(stimBox));
    stimBoxParam = [stimPosX, stimPosY, stimPosX + stimWidth, stimPosY + stimHeight];
    Screen('DrawTextures', wPtr, stimBoxTex, [], stimBoxParam');
    
    Screen('Flip', wPtr, [], 1);
    Screen('Close', stimBoxTex);
    if( nargin >= 4 )
        testMsg = pnet(modelCommID, 'read', 'noblock', 'view');
        if(~isempty(testMsg))
            pnet(modelCommID, 'read', 'noblock');
            SyncMsg(modelCommID);
        end
        
        UpdateDisplayMsg(modelCommID, deckParam, deckColors, ...
            'IGT', 'false', [], {stimBoxParam, 'bowl'});
        WaitProcDisplay(modelCommID);
        %StimBoxMsg(modelCommID, stimBoxParam, 'bowl', 'IGT');
        
        %keyboard
    end
end