dev.gamez.lv Forum Index dev.gamez.lv
Latvian Game Developers Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 

kaa pataisiit window callback funkciju par classes memberu

 
dev.gamez.lv Forum Index -> Programmēšana
View previous topic :: View next topic  
Author Message
GiGa
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 25 Sep 2003
Posts: 887

PostPosted: 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 Smile ) 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
View user's profile Send e-mail
chaosman



Joined: 28 Oct 2003
Posts: 64
Location: Rīga

PostPosted: 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
View user's profile
GiGa
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 25 Sep 2003
Posts: 887

PostPosted: 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
View user's profile Send e-mail
GiGa
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 25 Sep 2003
Posts: 887

PostPosted: Mon Jan 05, 2004 10:41 pm    Post subject:

Ehh, tagad pamaniiju chaos postu Smile

mans "manual" pie viena klasesbiedra, kurs tikko saak maaciities C++, taapee kameer netaa atradu ko vajag pagaaja bisku laiks un puules Smile
_________________
Back to top
View user's profile Send e-mail
Display posts from previous:   
dev.gamez.lv Forum Index -> Programmēšana All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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