|
dev.gamez.lv Latvian Game Developers Community
|
View previous topic :: View next topic |
Author |
Message |
GiGa Indago Uzvarētājs
Joined: 25 Sep 2003 Posts: 887
|
Posted: Mon Jan 05, 2004 8:54 pm Post subject: kaa pataisiit window callback funkciju par classes memberu |
|
Sveikinji,
shitas vairaak ir WinAPI jautaajums, bet taakaa specific API foruma mums nav, tad naaksies vien postot te...
man te radaas taada probleema, gribeeju uzrakstiit savam OGL logam jauku, inkapsuleetu class'i un nevaru savu Window callback funkciju (pat necentiishos to pateikt latviski ) uztaisiit par class'es memberu, ir errors luuk sheit:
Code: |
wc.lpfnWndProc= (WNDPROC) WndProc;
|
saka ka Quote: | no matches converting function `WndProc' to type 'LRESULT |
kaukur man atminjaa ieshaavaas, ka tai funkcijai jaabuut static, nu tad es klases definiicija pieliku klaat static luuk sheit:
Code: |
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
tas itkaa izlabo to iepriekseejo probleemu, bet tagad paraadaas cita: pashaa callback funkcijaa man ir errors:
Quote: |
In static member function `static LRESULT
cannot call member function `GLvoid
|
wtf tas noziimee? es no static member funkcijas nevaru izsaukt taas pashas klases citas member funkcijas ?
shito var kaukaa apiet? galvenais meerkis buutu dabuut WndProc par member funkciju _________________
|
|
Back to top |
|
|
chaosman
Joined: 28 Oct 2003 Posts: 64 Location: Rīga
|
Posted: Mon Jan 05, 2004 10:23 pm Post subject: |
|
Nu no static member funkcijas nebuus iespeejams tikt klaat klases datiem vai funkcijaam - taapec jau taa ir static, t.i. bez this pointera kaa pirmaa argumenta. Kaa saka "consult your C++ manual" :)
ja nu tev tieshaam vajag to funkciju ieksh kaadas klases tad lieto aptuveni taadu kodu
Code: |
class C
{
static C* This;
public:
C()
{
This = this;
}
static void StaticMember();
/* ... */
void Blah();
};
C::StaticMember()
{
This->Blah();
/* ... */
}
|
|
|
Back to top |
|
|
GiGa Indago Uzvarētājs
Joined: 25 Sep 2003 Posts: 887
|
Posted: Mon Jan 05, 2004 10:38 pm Post subject: |
|
Ehh, izraadaas ka static funkcijaam nav pieejami citi class memberi kuri arii nav static :(
well, ok, izlaboju taadaa veidaa, ka tagad CreateWindow funkcijai dodu pointeru uz callback funkciju, labums taads, ka katram logam var buut savaadaaka callback funk... _________________
|
|
Back to top |
|
|
GiGa Indago Uzvarētājs
Joined: 25 Sep 2003 Posts: 887
|
Posted: Mon Jan 05, 2004 10:41 pm Post subject: |
|
Ehh, tagad pamaniiju chaos postu
mans "manual" pie viena klasesbiedra, kurs tikko saak maaciities C++, taapee kameer netaa atradu ko vajag pagaaja bisku laiks un puules _________________
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|