PDA

View Full Version : [Tutorial] iTunes Controlling Ingame


drewpaul86
12th December 2005, 06:50
I modified this iTunes Controller Class, but I found it useful and modified it cause it was giving me errors when using.

Credits for the class in iTunes.h

Personal Credits
- All those in iTunes.h
- temp2
- tami
- humm3r



here's the code i used to allow this to work.


#include "iTunes.h"
using namespace::_com_util;

bool biTunesStatus = true;
bool biTunesInit = false;


put this in a rendering function. I use postrender



Initialize();
MyCanvas->DrawColor = FColor(255,0,0,255);
if ( ConvertBSTRToString(GetCurTrackInfo(TRACK_ARTIST)) != NULL )
{

DrawPosition(10,260);
MyCanvas->WrappedPrintf(MyCanvas->SmallFont,0,TEXT("Artist: "));
DrawPosition(50,260);
if ( ConvertBSTRToString(GetCurTrackInfo(TRACK_ALBUM)) != NULL )
MyCanvas->WrappedPrintf(MyCanvas->SmallFont,0,GetCurTrackInfo(TRACK_ARTIST));
else
MyCanvas->WrappedPrintf(MyCanvas->SmallFont,0,TEXT("Unknown"));
DrawPosition(10,270);
MyCanvas->WrappedPrintf(MyCanvas->SmallFont,0,TEXT("Album: "));
DrawPosition(50,270);
if ( ConvertBSTRToString(GetCurTrackInfo(TRACK_ALBUM)) != NULL )
MyCanvas->WrappedPrintf(MyCanvas->SmallFont,0,GetCurTrackInfo(TRACK_ALBUM));
else
MyCanvas->WrappedPrintf(MyCanvas->SmallFont,0,TEXT("Unknown"));

DrawPosition(10,280);
MyCanvas->WrappedPrintf(MyCanvas->SmallFont,0,TEXT("Track: "));
DrawPosition(50,280);
MyCanvas->WrappedPrintf(MyCanvas->SmallFont,0,GetCurTrackInfo(TRACK_TITLE));
} else {
DrawPosition(10,265);
MyCanvas->WrappedPrintf(MyCanvas->SmallFont,0,TEXT(" Goto iTunes "));
DrawPosition(10,275);
MyCanvas->WrappedPrintf(MyCanvas->SmallFont,0,TEXT("Select Playlist/Album"));
}

Destroy();


and i use this to toggle it.



if ( GetAsyncKeyState(VK_F5) ) { //Last Track
while(GetAsyncKeyState(VK_F5) )
Sleep(1);

Prev();
}

if ( GetAsyncKeyState(VK_F6) ) { // Pause
while(GetAsyncKeyState(VK_F6) )
Sleep(1);

Pause();
}

if ( GetAsyncKeyState(VK_F7) ) { // Play
while(GetAsyncKeyState(VK_F7) )
Sleep(1);

Play();
}

if ( GetAsyncKeyState(VK_F8) ) { // Next Track
while(GetAsyncKeyState(VK_F8) )
Sleep(1);

Next();
}



found that song and found it appropriate at the time, so i was listening to it when too the ss.
i did not include the code to draw a box however. sry.

RuffianSoldier
12th December 2005, 08:21
lol GJ drew

KizZamP-
12th December 2005, 09:18
good job drew ,mmm nice song :p

itwasfunny
14th December 2005, 03:19
Awsome job! Thx

GLoGG
16th December 2005, 21:14
nice job there drew.
looks great bro ;)

C-X
17th December 2005, 14:00
OMG love it!
Very nice Drewz!

$T$
17th December 2005, 14:57
yep nice work here.