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

Logu limits???

 
dev.gamez.lv Forum Index -> Programmēšana
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Sun Aug 21, 2005 10:59 pm    Post subject: Logu limits???

Es pashlaik mazliet kodeeju c++, bet saskaaros ar vienu ljoti nepatiikamu faktu: nevaru uztaisiit vairaak par 5 child logiem. Vai tas ir kaads fikseets(nenjomemams) limits vai arii tas ir kkaa apejams(nonjemams)
Back to top
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Sun Aug 21, 2005 11:54 pm    Post subject:

Noteikti var vairāk. Visdrīzāk tev kodā kautkur kļūda.
Back to top
View user's profile Send e-mail
banshee



Joined: 22 Aug 2005
Posts: 10
Location: Behind you

PostPosted: Mon Aug 22, 2005 6:18 pm    Post subject:

Nu taa, izdomaaju pieregistreeties Cool .

Nu ja ir laiks, tad paluuktu pateikt kur tieshi:
Main.cpp
Code:

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char* cmdline, int cmdshow){
   CLogger logger("program_log.txt");
   logger.Log("Program - started\n");
   
   // integer for loops
   int i;

   // Galvenais logs
   logger.Log("Creating main window\n");
   CClass wclass("MAIN_WND_CLASS",hInstance,MainWndProc);
   wclass.Register();
   CMainWindow main(&wclass,"Title",WIDTH,HEIGHT,&logger);
   main.CreateWnd();
   
   // GL Logi
   logger.Log("Creating opengl compitable windows\n\n");

   COpenGLWindow gl[5];
   CClass oclass[5];

   oclass[0] = CClass("OPENGL1_CLASS",GetModuleHandle(0),GLProc1);
   oclass[1] = CClass("OPENGL2_CLASS",GetModuleHandle(0),GLProc2);
   oclass[2] = CClass("OPENGL3_CLASS",GetModuleHandle(0),GLProc3);
   oclass[3] = CClass("OPENGL4_CLASS",GetModuleHandle(0),GLProc4);

   for(i=0;i<4;i++){
      logger.Log("[%i]...",i+1);
      oclass[i].SetBackground(CreateSolidBrush(RGB(100,100,100)));
      oclass[i].Register();
      gl[i] = COpenGLWindow(&oclass[i],main.GetHWND(),0,0,100,100,&logger);
      gl[i].Show();
      
   }
   
   logger.Log("DONE\n");

   CClass ctool("TOOLBAR_CLASS",GetModuleHandle(0),ToolbarProc);
   ctool.Register();

   logger.Log("Create tool bar");
    CWindow tb(&ctool,"",0,0,640,64,&logger);
   tb.SetAsChild(main.GetHWND());
   tb.SetParam(&tb);
   tb.CreateWnd();
   SendMessage(main.GetHWND(),WM_ADDCHILD,0,(LPARAM)tb.GetHWND());

   SendMessage(main.GetHWND(),WM_SIZE,0,(LPARAM)(HEIGHT<<16|WIDTH));
   main.Show();
   logger.Log("\nMAIN LOOP STARTED\n\n");
   
   MSG msg;
   bool done = false;
   while(!done){
      if(PeekMessage(&msg,0,0,0,PM_REMOVE)){
         if(msg.message == WM_QUIT)
            done = true;
         else{
            TranslateMessage(&msg);
            DispatchMessage(&msg);
         }
      }else{
         // Rendereeshana
         for(int i=0;i<4;i++){
            gl[i].MakeCurrent();
            RenderScene();
            gl[i].Swap();
         }
      }
   }
   
   logger.Log("\nMAIN LOOP ENDED\n\n");

   for(i=0;i<4;i++)
      gl[i].DestroyGLWindow();
   tb.DestroyWnd();
   main.DestroyWnd();

   return 0;
}
window.h
Code:
class CWindow{
protected:
   CClass*   m_class;
   
   HWND   m_hWnd;
   HWND   m_parent;
   char*   m_title;

   DWORD   m_style;
   DWORD   m_exstyle;

   int      m_left, m_top;
   int      m_width, m_height;
   HMENU   m_menu;

   void*   m_param;

public:
   CLogger* m_logger;
   CWindow(){}
   CWindow(CClass* cls, char* title, int width, int height ,CLogger* logger);
   CWindow(CClass* cls, char* title, int left, int top, int width, int height, CLogger* logger);
   
   void SetDimensions(int left, int top, int width, int height); // Set window dimension
   void SetParent(HWND parent);   // Set parent window
   void SetParam(void* param);      // Set pointer to create structure
   void SetScrollbars();         // Set both scrollbars   WS_HSCROLL WS_VSCROLL
   void SetAsChild(HWND parent);   // be child WS_CHILD
   void SetAsWindow();            // be window WS_OVERLAPPEDWINDOW
   void SetToClipChildren();      //clip children WS_CLIPCHILDREN
   void SetToClipSiblings();      // clip siblings WS_CLIPSIBLINGS
   void SetAsAppWindow();         // WS_EX_APPWINDOW

   HWND GetHWND();               // Return HWND

   void Show();
   void Hide();
   bool CreateWnd();
   void DestroyWnd();
};
window.cpp
Code:
#include "window.h"

CWindow::CWindow(CClass* cls,char* title, int width, int height, CLogger* logger)
:m_logger(logger), m_class(cls),m_hWnd(0),m_parent(0), m_title(title),m_style(0),
m_exstyle(0), m_left(CW_USEDEFAULT),m_top(CW_USEDEFAULT),
m_width(width),m_height(height),m_menu(0){}

CWindow::CWindow(CClass* cls,char* title, int left, int top, int width, int height, CLogger* logger)
: m_logger(logger), m_class(cls),m_hWnd(0),m_parent(0), m_title(title),m_style(0),
m_exstyle(0), m_left(left),m_top(top),
m_width(width),m_height(height),m_menu(0){}

bool CWindow::CreateWnd(){
   m_hWnd = CreateWindowEx(m_exstyle,m_class->GetName(),m_title,
      m_style,m_left,m_top,m_width,m_height,m_parent,
      m_menu,m_class->GetInstance(),m_param);
   
   if(!m_hWnd){
      //////////////////////////
   TCHAR szBuf[80];
    TCHAR* lpMsgBuf;
    DWORD dw = GetLastError();

    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        dw,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPTSTR) &lpMsgBuf,
        0, NULL );

    wsprintf(szBuf,
        "because error %d: %s",
        dw, lpMsgBuf);
 
    LocalFree(lpMsgBuf);
   ///////////////////
      m_logger->Log("Can't create window(%s)\n [%s]",m_title,szBuf);
      return false;
   }

   m_logger->Log("Created window(%s)\n",m_title);
   ShowWindow(m_hWnd,1);
   UpdateWindow(m_hWnd);
    return true;
}

void CWindow::DestroyWnd(){
   if(m_hWnd){
      DestroyWindow(m_hWnd);
      m_logger->Log("Window %s(class: %s) destroyed\n",m_title,m_class->GetName());
   }
}

void CWindow::SetDimensions(int left, int top, int width, int height){
   m_left = left;
   m_top = top;
   m_width = width;
   m_height = height;
}

void CWindow::SetParent(HWND parent){
   m_parent = parent;
}

void CWindow::SetParam(void* param){
   m_param = param;
}

void CWindow::SetScrollbars(){
   m_style |= WS_HSCROLL;
   m_style |= WS_VSCROLL;
}

void CWindow::SetAsChild(HWND parent){
   m_style |=WS_CHILD;
   m_parent = parent;
}

void CWindow::SetAsWindow(){
   m_style |=WS_OVERLAPPEDWINDOW;
   m_parent = 0;
}

void CWindow::SetToClipChildren(){
   m_style |=WS_CLIPCHILDREN;   
}

void CWindow::SetToClipSiblings(){
   m_style |=WS_CLIPSIBLINGS;   
}

void CWindow::SetAsAppWindow(){
   m_exstyle|=WS_EX_APPWINDOW;   
}

HWND CWindow::GetHWND(){
   return m_hWnd;
}

void CWindow::Show(){
   ShowWindow(m_hWnd,SW_SHOW);
}

void CWindow::Hide(){
   ShowWindow(m_hWnd,SW_HIDE);
}


logger.txt wrote:

=== Logger Initialized ===
Program - started
Creating main window
Created window(Title)
Creating opengl compitable windows

[1]...Created window()
Got device context
Pixel format set
rendering context created
OpenGL context created
[2]...Created window()
Got device context
Pixel format set
rendering context created
OpenGL context created
[3]...Created window()
Got device context
Pixel format set
rendering context created
OpenGL context created
[4]...Created window()
Got device context
Pixel format set
rendering context created
OpenGL context created
DONE
Create tool barCan't create window()
[because error 0: The operation completed successfully.

]
MAIN LOOP STARTED


MAIN LOOP ENDED

Window (class: OPENGL1_CLASS) destroyed
Can't unload rendering context
Window (class: OPENGL2_CLASS) destroyed
Can't unload rendering context
Window (class: OPENGL3_CLASS) destroyed
Can't unload rendering context
Window (class: OPENGL4_CLASS) destroyed
Window Title(class: MAIN_WND_CLASS) destroyed

Luudzu nesuudzaties par daudzumu Rolling Eyes
Shito CWindow izmanto arii COpenGLWindow un CMainWindow
Ja te tik garus postus publiceet nedriikst, luudzu iedodiet kaadu ftp servera adresi, kur nobaazt txt ar visu shito[/quote]
_________________
If you hear me screaming- you'll be dead
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