"2DM example code" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "2DM example code" answered properly. Developers are finding an appropriate answer about 2DM example code related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like 2DM example code. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on 2DM example code.
2DM example code
#include "2DM.h"
int main(void) {
WINDOW window = createWindow("2DM Window", 500, 500, WINDOW_NORMAL);
centerWindow(&window);
setIcon(&window, "icon.bmp"); //.ico in windows, .bmp in linux
float alpha = 0.0f;
while(window.open) {
//Events
if(pollEvents(&window)) {
switch(event.eventType) {
case CLOSE:
closeWindow(&window);
break;
case RESIZE:
{
updateWindowViewport(&window);
VEC2I windowSize = getWindowSize(&window);
printf("Window resized X:%d, Y:%d\n", windowSize.x, windowSize.y);
}
break;
#if defined(PLATFORM_WINAPI)
case RESIZING:
{
updateWindowViewport(&window);
VEC2I windowSize = getWindowSize(&window);
printf("Window resized with mouse X:%d, Y:%d\n", windowSize.x, windowSize.y);
}
break;
#endif
case KEYDOWN:
puts("Key down");
break;
case MOUSE_LBUTTON_PRESSED:
{
VEC2I mousePosition = getMousePosition(&window);
printf("Mouse X: %d, Mouse Y: %d\n", mousePosition.x, mousePosition.y);
}
break;
case MOUSE_RBUTTON_PRESSED:
puts("Right button pressed");
break;
}
}
if(isKeyPressed(A)) alpha -=1;
if(isKeyPressed(D)) alpha +=1;
//Draw
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(alpha, 0.0f, 1.0f, 0.0f);
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(0.0f, 0.75f);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex2f(-0.75f, -0.75f);
glColor3f(0.0f, 0.0f, 1.0f);
glVertex2f(0.75f, -0.75f);
glEnd();
glPopMatrix();
display(&window);
delay(10);
}
closeWindow(&window);
return 0;
}
Source: github.com
All those coders who are working on the Whatever based application and are stuck on 2DM example code can get a collection of related answers to their query. Programmers need to enter their query on 2DM example code related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about 2DM example code for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of 2DM example code while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "2DM example code". Visit this developer's friendly online web community, CodeProZone, and get your queries like 2DM example code resolved professionally and stay updated to the latest Whatever updates.