Thread: AntTweakBar
View Single Post
Old 08-07-2013   #1
TerMi
Tayip
 
Join Date: Jul 2013
Posts: 1
TerMi is an unknown quantity at this point
AntTweakBar

I am only asking for persons who have c++ knowledge to help me with this GUI library, i tried a few times without any c++ knowledge but couldn't get anywhere.

So what i am trying is to Open a AntTweakBar menu in game(GTA 4).

My first Code :

// ClassLibrary1.h

#pragma once

//uses
using namespace System;
using namespace Drawing;
using namespace IO;
using namespace GTA;



//includes

#include <C:\Users\Tayip\Desktop\Gta 4 modding\Gta 4 modding\scripting\Glut\include\GL\freeglut.h>
#include <C:\Users\Tayip\Desktop\Gta 4 modding\Gta 4 modding\scripting\Glut\include\GL\AntTweakBar.h>

// Callback function called by GLUT when window size changes
void Reshape(int width, int height)
{
// Set OpenGL viewport and camera
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(40, (double)width/height, 1, 10);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,5, 0,0,0, 0,1,0);
// Send the new window size to AntTweakBar
TwWindowSize(width, height);
}
void renderScene(void) {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex2f(-0.5,-0.5);
glVertex2f(0.5,0.0);
glVertex2f(0.0,0.5);
glEnd();
TwDraw();
glutSwapBuffers();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(50,50);
glutInitWindowSize(320,320);
glutCreateWindow("AntTweakBar");
glutDisplayFunc(renderScene);
glutReshapeFunc(Reshape);
TwInit(TW_OPENGL, NULL);
TwWindowSize(300,300);
TwBar *myBar;
myBar = TwNewBar("Test");

// Set GLUT event callbacks
// - Directly redirect GLUT mouse button events to AntTweakBar
glutMouseFunc((GLUTmousebuttonfun)TwEventMouseButt onGLUT);
// - Directly redirect GLUT mouse motion events to AntTweakBar
glutMotionFunc((GLUTmousemotionfun)TwEventMouseMot ionGLUT);
// - Directly redirect GLUT mouse "passive" motion events to
glutPassiveMotionFunc((GLUTmousemotionfun)TwEventM ouseMotionGLUT);
// - Directly redirect GLUT key events to AntTweakBar
glutKeyboardFunc((GLUTkeyboardfun)TwEventKeyboardG LUT);
// - Directly redirect GLUT special key events to AntTweakBar
glutSpecialFunc((GLUTspecialfun)TwEventSpecialGLUT );
// - Send 'glutGetModifers' function pointer to AntTweakBar;
// required because the GLUT key event functions do not report
TwGLUTModifiersFunc(glutGetModifiers);
glutMainLoop();
}


(succesull compile tough)
so if you can help me, contact from

Skype : termipysayko
TerMi is offline   Reply With Quote