Guest User

Untitled

a guest
Nov 16th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.62 KB | None | 0 0
  1. #pragma once
  2. #include "segui_base.h"
  3.  
  4. ///////////////////////////////////////////////////////////////////////////////
  5. // ---> GUI_user_panel.GuiModule.h
  6. ///////////////////////////////////////////////////////////////////////////////
  7.  
  8. class GUI_user_panel : public SEGUI_base {
  9. public:
  10.     GUI_user_panel(seGuiCallback seaudioMaster, void *p_resvd1);
  11.     ~GUI_user_panel(void);
  12.     void Initialise(bool loaded_from_file);
  13.     bool OnIdle(void);
  14.     void OnModuleMsg(int p_user_msg_id,int p_length, void * p_data);
  15.     void Init();
  16.  
  17.    
  18. private:
  19.  
  20.  
  21.     virtual void OnGuiPinValueChange(SeGuiPin *p_pin);
  22.    
  23.  
  24.     int count;
  25.     int *p_count;
  26.     int z;
  27.     char str[2];
  28.  
  29.     int myval_1;
  30.     int myval_2;
  31.     int myval_3;
  32.     int myval_4;
  33.     int myval_5;
  34.     int myval_6;
  35.     int myval_7;
  36.     int myval_8;
  37.        
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. };
  45.  
  46.  
  47. ///////////////////////////////////////////////////////////////////////////////
  48. // ---> GUI_user_panel.GuiModule.cpp
  49. ///////////////////////////////////////////////////////////////////////////////
  50.  
  51. #include "guimodule.h"
  52. //#include <string>
  53. //#include <cstdlib>
  54. //#include <time.h>
  55. //#include <assert.h>
  56.  
  57.  
  58.  
  59. GUI_user_panel::GUI_user_panel(seGuiCallback seaudioMaster, void *p_resvd1) : SEGUI_base(seaudioMaster, p_resvd1)
  60. {
  61.    
  62. }
  63.  
  64. GUI_user_panel::~GUI_user_panel(void)
  65. {
  66.     CallHost(seGuiHostSetIdle, 0 ); // cancel OnIdle events
  67.  
  68. }
  69.  
  70. void GUI_user_panel::OnModuleMsg(int p_user_msg_id,int p_length, void * p_data)
  71. {
  72.  
  73. }
  74.  
  75.  
  76. bool GUI_user_panel::OnIdle(void)
  77. {
  78.     return true;
  79. }
  80.  
  81. void GUI_user_panel::Initialise(bool loaded_from_file)
  82. {
  83.     CallHost(seGuiHostSetIdle, 0 );
  84.     SEGUI_base::Initialise(loaded_from_file);
  85.     if(loaded_from_file == true){
  86.        
  87.  
  88.     };
  89.     count=0;
  90.     z=0;
  91.  
  92.    
  93. }
  94.  
  95. void GUI_user_panel::Init()
  96. {
  97.  
  98. }
  99.  
  100. void GUI_user_panel::OnGuiPinValueChange(SeGuiPin *p_pin)
  101. {
  102.    
  103.         //read pins input
  104.         myval_1=getPin(0)->getValueInt(); //
  105.         myval_2=getPin(1)->getValueInt(); //
  106.         myval_3=getPin(2)->getValueInt(); //
  107.         myval_4=getPin(3)->getValueInt(); //
  108.         myval_5=getPin(4)->getValueInt(); //
  109.         myval_6=getPin(5)->getValueInt(); //
  110.         myval_7=getPin(6)->getValueInt(); //
  111.         myval_8=getPin(7)->getValueInt(); //
  112.        
  113.        
  114.         //inputs are "true"?
  115.         if ( myval_1 == 1 || myval_2 == 1 || myval_3 == 1 || myval_4 == 1 ||
  116.              myval_5 == 1 || myval_6 == 1 || myval_7 == 1 || myval_8 == 1  )
  117.         {
  118.            
  119.            
  120.             //getPin(8)->setValueInt(count);   
  121.             if (count>1){count=0;}
  122.             else count++;// fuehrt zum absturz (count=1; wuerde klappen)
  123.            
  124.            
  125.         }
  126.  
  127.         getPin(8)->setValueInt(count); //ausgabe an pin
  128.                
  129.         //sprintf(str,"%d%d",z,last_z);
  130.         //str[0]=
  131.         //str[1]='x';
  132.         //str[2]='\0';
  133.         //getPin(9)->setValueText(str);
  134. };
Add Comment
Please, Sign In to add comment