OSDN Git Service

[UI][Qt] Try:
authorK.Ohta <whatisthis.sowhat@gmail.com>
Fri, 11 Dec 2015 13:20:37 +0000 (22:20 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Fri, 11 Dec 2015 13:20:37 +0000 (22:20 +0900)
source/src/qt/common/draw_thread.cpp
source/src/qt/common/emu_thread.cpp
source/src/qt/common/qt_gldraw.cpp
source/src/qt/common/qt_gldraw.h
source/src/qt/common/qt_main.cpp
source/src/qt/osd.h

index a3409d5..24dfb37 100644 (file)
@@ -32,8 +32,6 @@ void DrawThreadClass::doDraw(bool flag)
        if(flag) {
                emit sig_draw_timing(true);
                draw_frames = p_emu->draw_screen();
-               //p = p_emu->getPseudoVramClass(); 
-               //emit sig_update_screen(p);
        } else {
                draw_frames = 1;
        }
index 282492b..995f76f 100644 (file)
@@ -499,7 +499,7 @@ void EmuThreadClass::doWork(const QString &params)
        bStartRecordSoundReq = false;
        bStopRecordSoundReq = false;
        
-       next_time = SDL_GetTicks();
+       next_time = 0;
        mouse_flag = false;
        p_emu->SetHostCpus(this->idealThreadCount());
        
@@ -531,11 +531,6 @@ void EmuThreadClass::doWork(const QString &params)
                sleep_period = 0;
                if(p_emu) {
                        // drive machine
-#ifdef USE_DIG_RESOLUTION
-                       //p_emu->get_screen_resolution(&width, &height);
-                       //emit sig_set_grid_vertical(width, false);
-                       //emit sig_set_grid_horizonal(height, false);
-#endif
 #ifdef USE_STATE
                        if(bLoadStateReq != false) {
                                p_emu->load_state();
@@ -603,7 +598,6 @@ void EmuThreadClass::doWork(const QString &params)
 
                        interval += get_interval();
                        now_skip = p_emu->now_skip() && !p_emu->now_rec_video();
-                       //p_emu->UnlockVM();
 
                        if((prev_skip && !now_skip) || next_time == 0) {
                                next_time = SDL_GetTicks();
@@ -649,7 +643,7 @@ void EmuThreadClass::doWork(const QString &params)
                if(bRunThread == false){
                        goto _exit;
                }
-               if(sleep_period <= 0) sleep_period = 1; 
+               if(sleep_period <= 0) sleep_period = 1;
                msleep(sleep_period);
        } while(1);
 _exit:
index 94f0f1d..7987a14 100644 (file)
@@ -157,7 +157,6 @@ void GLDrawClass::drawBitmapTexture(void)
                }
                if(vertex_bitmap->isCreated()) {
                        main_shader->setUniformValue("texture", 0);
-                       //main_shader->setUniformValue("v_texcoord", *texture_texcoord);
                        extfunc->glClear(GL_COLOR_BUFFER_BIT);
                        vertex_bitmap->bind();
                        extfunc->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
@@ -459,11 +458,6 @@ void GLDrawClass::resizeGL(int width, int height)
        extfunc->glViewport(0, 0, width, height);
        crt_flag = true;
 
-       req_draw_grids_horiz = true;
-       req_draw_grids_vert = true;
-       
-       if(draw_width  < ((horiz_pixels * 4) / 2)) req_draw_grids_horiz = false;
-       if(draw_height < ((vert_lines   * 2) / 2))   req_draw_grids_vert = false;
        doSetGridsHorizonal(vert_lines, true);
 #if defined(USE_VERTICAL_PIXEL_LINES)          
        doSetGridsVertical(horiz_pixels, true);
@@ -485,8 +479,6 @@ void GLDrawClass::resizeGL(int width, int height)
                setNormalVAO(main_shader, vertex_screen,
                                         buffer_screen_vertex,
                                         vertexFormat, 4);
-               this->doSetGridsHorizonal(screen_height, false);
-               this->doSetGridsVertical(screen_width, false);
        }
 
        
@@ -517,39 +509,6 @@ void GLDrawClass::resizeGL(int width, int height)
 #endif
 #if defined(MAX_BUTTONS)
        updateButtonTexture();
-       for(int i = 0; i < MAX_BUTTONS; i++) {
-#if 0          
-               fButtonX[i] = -1.0 + (float)(buttons[i].x * 2) / (float)SCREEN_WIDTH;
-               fButtonY[i] = 1.0 - (float)(buttons[i].y * 2) / (float)SCREEN_HEIGHT;
-               fButtonWidth[i] = (float)(buttons[i].width * 2) / (float)SCREEN_WIDTH;
-               fButtonHeight[i] = (float)(buttons[i].height * 2) / (float)SCREEN_HEIGHT;
-               VertexTexCoord_t vt[4];
-
-               vt[0] = vertexButtons->value(i * 4);
-               vt[1] = vertexButtons->value(i * 4 + 1);
-               vt[2] = vertexButtons->value(i * 4 + 2);
-               vt[3] = vertexButtons->value(i * 4 + 3);
-               
-               vt[0].x =  fButtonX[i];
-               vt[0].y =  fButtonY[i];
-                                          
-               vt[1].x =  fButtonX[i] + fButtonWidth[i];
-               vt[1].y =  fButtonY[i];
-               
-               vt[2].x =  fButtonX[i] + fButtonWidth[i];
-               vt[2].y =  fButtonY[i] - fButtonHeight[i];
-                                               
-               vt[3].x =  fButtonX[i];
-               vt[3].y =  fButtonY[i] - fButtonHeight[i];
-               
-               vertexButtons->replace(i * 4, vt[0]);
-               vertexButtons->replace(i * 4 + 1, vt[1]);
-               vertexButtons->replace(i * 4 + 2, vt[2]);
-               vertexButtons->replace(i * 4 + 3, vt[3]);
-               setNormalVAO(button_shader[i], vertex_button[i],
-                                        buffer_button_vertex[i],
-                                        vt, 4);
-#endif         
        }
 #endif
        redraw_required = true;
@@ -572,8 +531,6 @@ void GLDrawClass::paintGL(void)
 #endif
        if(!redraw_required) return;
        if(p_emu != NULL) {
-               //if(imgptr == NULL) return;
-               //drawUpdateTexture(imgptr);
                crt_flag = false;
        }
        if(redraw_required) {
@@ -650,8 +607,6 @@ GLDrawClass::GLDrawClass(QWidget *parent)
        button_updated = false;
        button_drawn = false;
 #endif
-       req_draw_grids_horiz = false;
-       req_draw_grids_vert = false;
        fBrightR = 1.0; // 輝度の初期化
        fBrightG = 1.0;
        fBrightB = 1.0;
index 9063518..d0d147e 100644 (file)
@@ -91,9 +91,6 @@ class GLDrawClass: public QGLWidget
        GLfloat *glVertGrids;
        GLfloat *glHorizGrids;
        
-       bool req_draw_grids_horiz;
-       bool req_draw_grids_vert;
-       
        int screen_texture_width;
        int screen_texture_width_old;
        int screen_texture_height;
index 52f007b..25f439f 100644 (file)
@@ -164,7 +164,6 @@ void Ui_MainWindow::LaunchEmuThread(void)
        int drvs;
        
        hRunEmu = new EmuThreadClass(rMainWindow, emu, this);
-       emu->set_parent_handler(hRunEmu);
        connect(hRunEmu, SIGNAL(message_changed(QString)), this, SLOT(message_status_bar(QString)));
        
        //connect(hRunEmu, SIGNAL(sig_finished()), this, SLOT(delete_emu_thread()));
@@ -254,10 +253,6 @@ void Ui_MainWindow::LaunchEmuThread(void)
 #ifdef USE_TAPE_BUTTON
        hRunEmu->set_tape_play(false);
 #endif
-#ifdef USE_DIG_RESOLUTION
-       connect(hRunEmu, SIGNAL(sig_set_grid_vertical(int, bool)), graphicsView, SLOT(doSetGridsVertical(int, bool)));
-       connect(hRunEmu, SIGNAL(sig_set_grid_horizonal(int, bool)), graphicsView, SLOT(doSetGridsHorizonal(int, bool)));
-#endif 
 #ifdef SUPPORT_DUMMY_DEVICE_LED
        connect(hRunEmu, SIGNAL(sig_send_data_led(quint32)), this, SLOT(do_recv_data_led(quint32)));
 #endif
@@ -271,18 +266,17 @@ void Ui_MainWindow::LaunchEmuThread(void)
        hRunEmu->setObjectName(objNameStr);
        
        hDrawEmu = new DrawThreadClass(emu, this);
+       emu->set_parent_handler(hRunEmu);
 #ifdef ONE_BOARD_MICRO_COMPUTER
        QImageReader *reader = new QImageReader(":/background.png");
        QImage *result = new QImage(reader->read()); // this acts as a default if the size is not matched
        glv->updateBitmap(result);
        delete result;
        delete reader;
-#endif   
-       
+#endif
        AGAR_DebugLog(AGAR_LOG_DEBUG, "DrawThread : Start.");
        connect(hDrawEmu, SIGNAL(sig_draw_frames(int)), hRunEmu, SLOT(print_framerate(int)));
        connect(hDrawEmu, SIGNAL(message_changed(QString)), this, SLOT(message_status_bar(QString)));
-       connect(hDrawEmu, SIGNAL(sig_update_screen(screen_buffer_t *)), glv, SLOT(update_screen(screen_buffer_t *)), Qt::QueuedConnection);
        connect(actionCapture_Screen, SIGNAL(triggered()), glv, SLOT(do_save_frame_screen()));
                
        connect(hRunEmu, SIGNAL(sig_draw_thread(bool)), hDrawEmu, SLOT(doDraw(bool)));
index e2aea33..f04ff21 100644 (file)
@@ -136,6 +136,7 @@ typedef struct {
 
 class GLDrawClass;
 class EmuThreadClass;
+class DrawThreadClass;
 class Ui_MainWindow;
 class EMU;
 class VM;