paragui-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-cvs] CVS: paragui/test dummytest.cpp,NONE,1.1.2.1 Makefile.am,1


From: Teunis Peters <address@hidden>
Subject: [paragui-cvs] CVS: paragui/test dummytest.cpp,NONE,1.1.2.1 Makefile.am,1.6.2.4,1.6.2.5 gltest.cpp,1.1.2.6,1.1.2.7 paratest.cpp,1.9.2.6,1.9.2.7
Date: Thu, 31 Oct 2002 05:38:06 -0500

Update of /cvsroot/paragui/paragui/test
In directory subversions:/tmp/cvs-serv23350/test

Modified Files:
      Tag: devel-opengl
        Makefile.am gltest.cpp paratest.cpp 
Added Files:
      Tag: devel-opengl
        dummytest.cpp 
Log Message:
LOTS of updates.
This branch now largely works - actually outside of what seems to be a 
libstdc++ bug that triggers in paratest, all the tests now work except gltest 
and testdummy.
OpenGL driver DOES work, but isn't complete.  Also tends to crash when opengl 
isn't threadsafe... such as with Matrox G450 *sigh*.
Dummy driver still needs updates.


--- NEW FILE ---
/* dummytest.cpp
 * -------------
 * dummy driver test
 */

#include "paragui.h"
#include "pgapplication.h"
#include "pgtabbar.h"
#include "pglabel.h"
#include "pgnotebook.h"
#include "pglistbox.h"
#include "pglistboxitem.h"
#include "pgcheckbutton.h"
#include "pgwindow.h"
#include "pglog.h"

#include "pgmenubar.h"
#include "pgtimerobject.h"

#include "pgdriver.h"

#define ID_APP_EXIT             1

bool exit_handler(PG_Button* button) {

        // exit the application eventloop
        PG_Application::GetInstance().Quit();

        // return true to signal that we have processed this message
        return true;
}

bool handle_menu_click(PG_MenuItem* item) {
        PG_Application& app = PG_Application::GetInstance();
        
        switch (item->getId()) {
          case ID_APP_EXIT:
                app.Quit();
                break;
        }

        return true;
}

bool handleListBoxItem(PG_ListBoxItem* item) {
        delete item;
        return true;
}

int main( int argc, char **argv ) {
  PG_Application& app = PG_Application::GetInstance();

  /* yay - tested working */
#ifdef HAVE_DUMMYVIDEO
  /* app.AddArchive("../src/draw/dummy"); */
  PG_VideoDriver* dummydriver = new PG_VideoDriver(app, PG_DUMMYVIDEO);
#endif
#if 0
# ifdef HAVE_OPENGL
   /* app.AddArchive("../src/draw/opengl"); */
   PG_VideoDriver* gldriver = new PG_VideoDriver(app, PG_GLVIDEO);
# endif
# ifdef HAVE_DIRECTX
   /* app.AddArchive("../src/draw/windx"); */
   PG_VideoDriver* dxdriver = new PG_VideoDriver(app, PG_DXVIDEO);
# endif
#endif

   PG_VideoDriver* activeD;
   /* set this to driver... going to make this a command line option
    * eventually I think...
    */
   activeD = dummydriver;
   
   if (activeD->valid()) {
      activeD->attach();
   } else {
      fprintf(stderr, "Video driver failed to initialize! - Quitting...");
      return -1;
   };

  app.InitScreen(640, 480, 0, SDL_DOUBLEBUF);
  app.LoadTheme("default");

  app.SetEmergencyQuit(true);
  /* fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__); */

  PG_Rect rect(0, 0, 80, 30);
  PG_Button myButton(NULL,1,rect,"Quit");
  myButton.sigButtonClick.connect(slot(exit_handler));
  myButton.Show();

#if 0
  PG_MenuBar menubar(NULL, PG_Rect(100, 0, 400, 30));
  PG_PopupMenu   popmenu(NULL, 425, 140, "File");
  popmenu.addMenuItem("Nail", 99, slot(handle_menu_click)).
    addMenuItem("Quit", ID_APP_EXIT, slot(handle_menu_click));
  menubar.Add("File", &popmenu);
  menubar.Show();
#endif

#if 0  
  PG_ListBox listbox(NULL, PG_Rect(10,40,300,100));
  listbox.sigSelectItem.connect(slot(handleListBoxItem));
  
  new PG_ListBoxItem(&listbox, 25, "Item1");
  new PG_ListBoxItem(&listbox, 25, "Item2");
  new PG_ListBoxItem(&listbox, 25, "Item3");
  new PG_ListBoxItem(&listbox, 25, "Item4");
  new PG_ListBoxItem(&listbox, 25, "Item5");
  new PG_ListBoxItem(&listbox, 25, "Item6");
  new PG_ListBoxItem(&listbox, 25, "Item7");
  new PG_ListBoxItem(&listbox, 25, "Item8");
  new PG_ListBoxItem(&listbox, 25, "Item9");
  new PG_ListBoxItem(&listbox, 25, "Item10");
  listbox.Show();
#endif
  
  app.Run();
  delete activeD;
  return 0;
}

Index: Makefile.am
===================================================================
RCS file: /cvsroot/paragui/paragui/test/Makefile.am,v
retrieving revision 1.6.2.4
retrieving revision 1.6.2.5
diff -C2 -r1.6.2.4 -r1.6.2.5
*** Makefile.am 31 Aug 2002 04:01:25 -0000      1.6.2.4
--- Makefile.am 31 Oct 2002 10:38:04 -0000      1.6.2.5
***************
*** 1,5 ****
  AUTOMAKE_OPTIONS = foreign
  
! bin_PROGRAMS = writefile stress1 stress2 tabbar xmlloader listbox factory 
animation dropdown paratest dblbuffer navtest windowresize gltest windowtest
  # windowtest obsolete...
  
--- 1,5 ----
  AUTOMAKE_OPTIONS = foreign
  
! bin_PROGRAMS = writefile stress1 stress2 tabbar xmlloader listbox factory 
animation dropdown paratest dblbuffer navtest windowresize gltest windowtest 
dummytest
  # windowtest obsolete...
  
***************
*** 51,54 ****
--- 51,57 ----
  gltest_SOURCES = gltest.cpp
  gltest_LDADD = -L../src $(PARAGUI_LIBS)
+ 
+ dummytest_SOURCES = dummytest.cpp
+ dummytest_LDADD = -L../src $(PARAGUI_LIBS)
  
  #INCLUDES = \

Index: gltest.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/Attic/gltest.cpp,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -r1.1.2.6 -r1.1.2.7
*** gltest.cpp  30 Oct 2002 09:16:29 -0000      1.1.2.6
--- gltest.cpp  31 Oct 2002 10:38:04 -0000      1.1.2.7
***************
*** 294,297 ****
--- 294,298 ----
  #endif
  #endif
+   PG_LogMSG("%s[%s:%i]: driver %p", __FUNCTION__, __FILE__, __LINE__, 
gldriver);
    if (gldriver->valid()) {
      gldriver->attach();
***************
*** 322,326 ****
    myButton.Show();
  
! #if 0
    PG_MenuBar menubar(NULL, PG_Rect(100, 0, 400, 30));
    PG_PopupMenu   popmenu(NULL, 425, 140, "File");
--- 323,327 ----
    myButton.Show();
  
! #if 1
    PG_MenuBar menubar(NULL, PG_Rect(100, 0, 400, 30));
    PG_PopupMenu   popmenu(NULL, 425, 140, "File");
***************
*** 348,352 ****
  #endif
  
! #if 0
    PlayField2 anim_test2(NULL,
                        PG_Rect(260, 300, 120, 100)
--- 349,353 ----
  #endif
  
! #if 1
    PlayField2 anim_test2(NULL,
                        PG_Rect(260, 300, 120, 100)

Index: paratest.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/test/paratest.cpp,v
retrieving revision 1.9.2.6
retrieving revision 1.9.2.7
diff -C2 -r1.9.2.6 -r1.9.2.7
*** paratest.cpp        7 Oct 2002 22:23:26 -0000       1.9.2.6
--- paratest.cpp        31 Oct 2002 10:38:04 -0000      1.9.2.7
***************
*** 26,29 ****
--- 26,30 ----
  #include "pgmenubar.h"
  #include "pgtheme.h"
+ #include "pgdriver.h"
  
  #define RESX 800
***************
*** 305,308 ****
--- 306,310 ----
        // construct the application object
        PG_Application& app = PG_Application::GetInstance();
+       PG_VideoDriver* gldriver = NULL;
  
        for(int c=1; c<argc; c++) {
***************
*** 337,341 ****
--- 339,368 ----
                        resy = atoi(argv[++c]);
                }
+ 
+ #ifdef HAVE_OPENGL
+               if(strcmp(argv[c], "-gl") == 0) {
+                 gldriver = new PG_VideoDriver(app, PG_GLVIDEO);
+               }
+ #endif
+ 
+ #ifdef HAVE_DUMMYVIDEO
+               if(strcmp(argv[c], "-dummy") == 0) {
+                 gldriver = new PG_VideoDriver(app, PG_DUMMYVIDEO);
+               }
+ #endif
+ #ifdef HAVE_DIRECTX
+               if(strcmp(argv[c], "-DX") == 0) {
+                 gldriver = new PG_VideoDriver(app, PG_DXVIDEO);
+               }
+ #endif
        }
+       if (gldriver != NULL) {
+         if (gldriver->valid()) {
+           gldriver->attach();
+         } else {
+           fprintf(stderr, "graphics driver failed to initialize! - 
Quitting...");
+           return -1;
+         };
+       };
  
        Uint32 start_ticks = SDL_GetTicks();





reply via email to

[Prev in Thread] Current Thread [Next in Thread]