|
Thanks for the help Christian. ill remember that
|
|
|
|
|
I have very basic question.I read some tutorials but didn't get one thing,I want to know what is "texture filters".I don't know what is it and what's they are good for?
Can anybody tell me about it in simple words?
thanks
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I'm surprised Christian hasn't answered you...? Christian where are you...?
Textures are the images you map to polygons, this I assume you know...filters are usually...ummm just that...filter certain content...
Graphics filters...in psp7 seem to allow you to apply special effects...IE 4.0+ supports a feature called Filters and Transitions which again apply certain effects to elements.
So it's my best reasoning that texture filters are probably filters you apply to images(textures) for a certian effect...like changing the alpha-factor (which I think is what gives textures semi-transluecency)
Yup...these are my guesses from my work with graphics...
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
hmmm,thanks HockeyDude.
HockeyDude wrote:
I'm surprised Christian hasn't answered you...? Christian where are you...?
I was waiting for his answer too
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hi.
I am working on a small practice program for a C++ class. I need to implement a way to delimite using EOF. The user can break out of a while, for example, with ctrl-d (dos) or ctrl-z (unix).
What is the best way to implement something like that?
I have tried this:
while((num = cin.get()) != EOF) // from Deitel
{}
The above does not work.
Thanks,
Kuphryn
|
|
|
|
|
I didn't use it in C++,but just guess,try this:
while(cin.get()!=EOF)
{
}
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hello
Say I am writing an ATL component.
Which are the various methods available to me to return a VB/ASP array?
From VB/ASP I should be able to do something like this :-
Set x = CreateObject("ABC.abx")
y=x.GetNiceLongArray()
for each t in y
response.write t
next
Any ideas, help is hugely appreciated.
I think someone told me abt safe arrays, last week. But last 7 days I didnt touch this stuff again ...
Now that it's a nice sunday, I thought I might as well do some learning...
Nish
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
Hi Nish:
public:
HRESULT FinalConstruct();
private:
std::vector(CComBSTR) m_vearray;--->I change this line because its like HTML tag,but you know the difference
Then add the implementation of FinalConstruct()
HRESULT CYourClass::FinalConstruct()
{
m_vearray.push_back(CComBSTR(L"Hello"));
return S_OK;
}
then add a property to your component with VARIANT * argument
STDMETHODIMP CYourclass::get_property(VARIANT * pVal)
{
VariantInit(pVal);
pVal->vt=VT_ARRAY|VT_BSTR;
SAFEARRAY *psa;
SAFEARRAYBOUND bounds=(m_vearray.size(),0);
psa=SafeArrayCreate(VT_BSTR,1,&bounds);
BSTR *bstrArray;
SafeArrayAccessData(psa,reiterpret_cast<void **>(&bstrArray));
std::vector(CComBSTR)::iterator it;--->change this line too
int i=0;
for(it=m_vearray.begin();it !=m_vearray.end();i++)
{
bstrArray[i]=SysAllocString((*it).m_str);
}
SafeArrayUnaccessData(psa);
pVal->parray=psa;
return S_OK;
}
Is that what you want Nish?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Mazdak wrote:
Is that what you want Nish?
Mazy
Hello Mazy
Thanks for that. But I wasnt looking for code snippets. Specially since most of it didnt make any sense to me. I have not spend too much time on ATL. Just a couple of hrs every week. Sometimes less than that.
From your post I understand I need to look into safe arrays.
I dont wanna use std::vector either.
So do you know any good intro stuff on safe arays.
The book I have [Inside ATL by Shephard and King] does not have a chapter on safe arrays
Regards and thanks once again
Nish
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
Nish [BusterBoy] wrote:
So do you know any good intro stuff on safe arays.
Hi Nish:
I don't have any intro about it,but some months ago,I found some articles about ATL at the link below,check it maybe you find something useful about ATL or safe array.
p2p.wrox.com
Nish [BusterBoy] wrote:
The book I have [Inside ATL by Shephard and King] does not have a chapter on safe arrays
I myself began ATL with "Beginning ATL3COM Programming by Richard Grimes" ,in this books some pages belong to safearray,the codes I used was from this book.I like this book because it goes in details of ATL.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Thanks Mazy
Nish
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
Nish [BusterBoy] wrote:
From your post I understand I need to look into safe arrays.
Yes, you do. I just did my first one of these on Friday, and read it in an .asp.
Nish [BusterBoy] wrote:
I dont wanna use std::vector either.
You can't anyhow, to impliment an automation compatible server, you need to stick to the object types defined by COM, not those specific to C++. However, why WOULDN'T you use vector ?
Nish [BusterBoy] wrote:
So do you know any good intro stuff on safe arays.
The book I have [Inside ATL by Shephard and King] does not have a chapter on safe arrays
Surely MSDN has some info ? The best ATL book I bought ( and I bought a lot ) was Creating lightweight components with ATL by Jonothan Bates. If you want to learn ATL, get this book. It has a half decent intro to STL in it, no match for a decent text, but an OK intro nonetheless.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
Christian Graus wrote:
You can't anyhow, to impliment an automation compatible server, you need to stick to the object types defined by COM, not those specific to C++.
Okay, then what's the ATL equivalent for std::vector ???
Nish
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
Internally, you'd use vector, but I believe the answer is VARIANT, which has VT_ARRAY as one of it's types, which needs to be ORed with an actual type to make an array of.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
Dear CG,
Thanks for that. But I am now horrified by a new realization.
Read my new post for more info...
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&select=124762#xx124762xx
Nish [still under shock]
It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
|
|
|
|
|
Check ATL's CSimpleArray / CSimpleMap. These templates are not documented, so you will have to take a look on the implementation
|
|
|
|
|
If you want to enumerate a collection there is another mechanism more flexible and interesting then SAFEARRAY - take a look at enumeration interfaces ( IEnumXXX). ATL has support for this ( IEnumOnSTLImpl, etc) but you can do it by yourself very easily.
|
|
|
|
|
hi:
how to new a doc in MDI application ?
Thanks
benben
|
|
|
|
|
If you have a pointer to the CDocTemplate for the document, you can create a new instance of it using
pDocTemplate->OpenDocumentFile(NULL) ;
If you need to do this from an existing doucment:
pDocTemplate = GetDocTemplate() ;
pDocTemplate->OpenDocumentFile(NULL) ;
or from anywhere else
CDocManager *pDocMan = AfxGetApp()->m_pDocManager ;
POSITION pos ;
pos = pDocMan->GetFirstDocTemplatePosition() ;
CDocTemplate *pDocTemplate = pDocMan->GetNextDocTemplate(pos) ;
pDocTemplate->OpenDocumentFile(NULL) ;
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
can anyone help me design a game tree for tictactoe. i am trying to do the recursion for the AI of the tictactoe and i cant seem to get it write. i decided to write the game tree 1st but i can figure out how to write it. can anyone kindly help me do that? anyways, thank you very much.
|
|
|
|
|
First of all...whats a game tree...?
Is this like a flowchart or something...?
What AI are you having problems with...determining a win with the active player or the computer making it's moves..?
Recursion will make your game logic IMO doubly hard...a simple double iteration loop would look much nicer on the eyes. Depending on how many times your recursion function is called, this could be very in-efficient. Unless i'm missing something...each time a function is called it pushe s it's params and locals onto a lifo stack, this could cause your stack to grow quite large i'd think.
Can you do it with a loop or MUST you use recursion...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
umm... i dont really have to do it using recursions. i am just practicing it for fun. oh a game tree is like a family with all the possible moves that can happen when playing tictactoe. i got my algorithm already just that i am having a harding trying to figure out how to evaluate the players moves then return the best move the computer can move. i was going to implement that by looking at a game tree but i can figure out how to write one. oh, i am trying to determine how the computer will move on the board after the player has moved. i made the computer as the 1st one to move as default. here is my algorithm:
Const int MAXDEPTH = 9;
CheckForMoves()
If Board is all Occupied or Player Won or Depthcount > MAXDEPTH
- return.
Else
- DepthCount++;
- GetPlayerMove(row & column);
- Evaluate Player Move and return the best move the computer can take.
If the Move the computer has made is a good move and The Board Cell is
empty.
- Computer makes the move
Else
- CheckForMoves() <-- Check for moves
I am getting a hard time trying to figure out how to evaluate the player move and how to make it return the best possible move and also how to check if the move done is a good move. well, if you guys think my algorithm logic is wrong let me know. and if so can you tell me a better algorithm to implement it
thank you very much...
|
|
|
|
|
AI for tic tac toe can be anything from simple as hell and fairly complex.
1) This simplest method of AI is to just iterate the array gameboard and check for NULL's, the first NULL = empty space which means...the computer should pick this spot.
Of course this doesn't leave for very interesting game play (not that tic tac toe would or could)
1) To spice things up a little you could add some more advanced AI and do something like...instead of take the first available spot...search the game board for a potential opponent win and fill that gap before they do, I think this would work best if the computer started second.
2) Then you could use a game tree (i'd never heard of that before). Something I was attempting to do in my comp sci class was actually dynamically store players moves in a db while executing and use this growing db as a method of choosing the next mostly likely win-win scenerio.
The second approach would best be suited for the computer if it starts second...but would provide night and day difference in AI...
If you sit down and think about it for a sec or two you'd probably think of a better way of doing this, but heres just a quick idea on how to implement this.
char move[9];
Then create an array of move's (tree) initialized with X and O's in different places. Use this tree to choose your next move.
The one downside to this method (which I just realised while writting this... is that you'd need one 'move' for each possible scenerio...to be able to use this method effectively...thats a whole lot of move[n]={X,O,O,X,O,X,X,O...}
This is only one possible solution to a problem which has many.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
|
Hi all,
I was wondering if there was a way to get/set the delay time between when a key is pressed and it starts to auto-repeat. Any info would be great.
TIA
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|