本文整理汇总了C++中EndDrawing函数的典型用法代码示例。如果您正苦于以下问题:C++ EndDrawing函数的具体用法?C++ EndDrawing怎么用?C++ EndDrawing使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EndDrawing函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: EndDrawing
/* virtual */ bool EditPanel::MouseButton( int btn, bool up )
{
if ( mDrawing && up )
{
EndDrawing();
return true;
}
if ( DrawPanel::MouseButton( btn, up ) )
{
return true;
}
bool left = btn == wxMOUSE_BTN_LEFT;
bool right = btn == wxMOUSE_BTN_RIGHT;
if (mMousePoint.x == -1 || mMousePoint.y == -1 || PointInZone( mMousePoint ) || !this->HasFocus() )
{
return false;
}
if (left || right)
{
mCurrentColour = right ? mRightColour : mLeftColour;
}
if ( !up && ( left || right ) )
{
return BeginDrawing();
}
return false;
}
开发者ID:old-games,项目名称:universal-translators-tool,代码行数:32,代码来源:editpanel.cpp
示例2: Test28
void Test28()
{
InitWindow();
static Bitmap bm;
bm.w = bm.h = 256; bm.form = BMFORMAT_B8G8R8A8; bm.pal = 0;
bm.pix = (uchar*)malloc(bm.w * bm.h * 4);
memset(bm.pix, 127, bm.w * bm.h * 4);
static int px = 61, py = 89, vx = 2, vy = -3;
*(uint*)(bm.pix + (py*bm.w + px) * 4) = -1;
static texture t = CreateTexture(&bm, 1);
while(!appexit)
{
px += vx; if(px < 0 || px >= 256) {px -= vx; vx = -vx;}
py += vy; if(py < 0 || py >= 256) {py -= vy; vy = -vy;}
*(uint*)(bm.pix + (py*bm.w + px) * 4) = -1;
renderer->UpdateTexture(t, &bm);
BeginDrawing();
InitRectDrawing();
SetTexture(0, t);
DrawRect(0, 0, 256, 256, -1);
EndDrawing();
HandleWindow();
}
}
开发者ID:AdrienTD,项目名称:wkbre,代码行数:27,代码来源:test.cpp
示例3: DrawGame
// Draw game (one frame)
void DrawGame(void)
{
BeginDrawing();
ClearBackground(RAYWHITE);
if (!gameOver)
{
DrawRectangleRec(player.rec, player.color);
if (wave == FIRST) DrawText("FIRST WAVE", screenWidth/2 - MeasureText("FIRST WAVE", 40)/2, screenHeight/2 - 40, 40, Fade(BLACK, alpha));
else if (wave == SECOND) DrawText("SECOND WAVE", screenWidth/2 - MeasureText("SECOND WAVE", 40)/2, screenHeight/2 - 40, 40, Fade(BLACK, alpha));
else if (wave == THIRD) DrawText("THIRD WAVE", screenWidth/2 - MeasureText("THIRD WAVE", 40)/2, screenHeight/2 - 40, 40, Fade(BLACK, alpha));
for (int i = 0; i < activeEnemies; i++)
{
if (enemy[i].active) DrawRectangleRec(enemy[i].rec, enemy[i].color);
}
for (int i = 0; i < NUM_SHOOTS; i++)
{
if (shoot[i].active) DrawRectangleRec(shoot[i].rec, shoot[i].color);
}
DrawText(FormatText("%04i", score), 20, 20, 40, GRAY);
if (victory) DrawText("YOU WIN", screenWidth/2 - MeasureText("YOU WIN", 40)/2, screenHeight/2 - 40, 40, BLACK);
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, GRAY);
}
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, GRAY);
EndDrawing();
}
开发者ID:tws0002,项目名称:raylib,代码行数:35,代码来源:space_invaders.c
示例4: Test3
void Test3()
{
LoadBCP("data.bcp");
ReadLanguageFile();
InitWindow();
//InitRectDrawing();
//IDirect3DTexture9 *mytex = GetTexture("Interface\\LOADING SCREEN 1.tga");
//IDirect3DPixelShader9 *psh = LoadPixelShader("test.psh");
InitScene(); LoadMap("testmap.bcm");
while(!appexit)
{
BeginDrawing();
//ddev->SetRenderState(D3DRS_ZENABLE, FALSE);
//ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
//ddev->SetPixelShader(psh);
//ddev->SetTexture(0, mytex);
//DrawRect(0, 0, 640, 480, -1);
DrawScene();
EndDrawing();
HandleWindow();
if(keyheld[VK_UP]) camerapos += Vector3(0.0f, 0.0f, walkstep);
if(keyheld[VK_DOWN]) camerapos -= Vector3(0.0f, 0.0f, walkstep);
if(keyheld[VK_LEFT]) camerapos -= Vector3(walkstep, 0.0f, 0.0f);
if(keyheld[VK_RIGHT]) camerapos += Vector3(walkstep, 0.0f, 0.0f);
if(keyheld['E']) camerapos += Vector3(0.0f, walkstep, 0.0f);
if(keyheld['D']) camerapos -= Vector3(0.0f, walkstep, 0.0f);
}
}
开发者ID:AdrienTD,项目名称:wkbre,代码行数:29,代码来源:test.cpp
示例5: main
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode");
// Define the camera to look into our 3d world
Camera camera;
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
DrawGrid(10, 1.0f);
End3dMode();
DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY);
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
开发者ID:phxvyper,项目名称:raylib,代码行数:59,代码来源:core_3d_mode.c
示例6: main
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards");
// Define the camera to look into our 3d world
Camera camera = {{ 5.0, 4.0, 5.0 }, { 0.0, 2.0, 0.0 }, { 0.0, 1.0, 0.0 }};
Texture2D bill = LoadTexture("resources/billboard.png"); // Our texture billboard
Vector3 billPosition = { 0.0, 2.0, 0.0 }; // Position where draw billboard
SetCameraMode(CAMERA_ORBITAL); // Set an orbital camera mode
SetCameraPosition(camera.position); // Set internal camera position to match our camera position
SetCameraTarget(camera.target); // Set internal camera target to match our camera target
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera); // Update internal camera and our camera
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
DrawBillboard(camera, bill, billPosition, 2.0f, WHITE);
DrawGrid(10.0, 1.0); // Draw a grid
End3dMode();
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(bill); // Unload texture
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
开发者ID:MarcMDE,项目名称:raylib,代码行数:59,代码来源:models_billboard.c
示例7: Test22
void Test22()
{
int curgrp = 0; char tb[512];
printf("Use LTTT? ");
int uselt = atoi(fgets(tb, 511, stdin));
LoadBCP("data.bcp");
InitWindow();
InitFont();
if(uselt) LoadLTTT("Maps\\Map_Textures\\128_4Peaks.lttt");
LoadMapTextures();
//MessageBox(hWindow, "Terrain textures loaded.", appName, 64);
printf("%u groups:\n", maptexgroup.len);
for(int i = 0; i < maptexgroup.len; i++)
{
MapTextureGroup *g = maptexgroup.getpnt(i);
printf(" * %s\n", g->name);
printf(" %u textures:\n", g->tex->len);
for(int j = 0; j < g->tex->len; j++)
printf(" - %u\n", g->tex->getpnt(j)->id);
}
//texture t = GetTexture("Warrior Kings Game Set\\Textures\\Tavern.pcx");
while(!appexit)
{
BeginDrawing();
InitRectDrawing();
//SetTexture(0, maptexgroup.getpnt(0)->tex->getpnt(0)->t);
//SetTexture(0, t);
//DrawRect(0, 0, 256, 256, -1);
MapTextureGroup *g = maptexgroup.getpnt(curgrp);
sprintf(tb, "%s (%u/%u)", g->name, curgrp, maptexgroup.len);
DrawFont(0, 0, tb);
for(int i = 0; i < g->tex->len; i++)
{
MapTexture *t = g->tex->getpnt(i);
SetTexture(0, t->t);
DrawRect(i * 65, 32, 64, 64, -1, t->x / 256.f, t->y / 256.f, t->w / 256.f, t->h / 256.f);
sprintf(tb, "%u", t->id);
DrawFont(i * 65, 96, tb);
}
if(keypressed[VK_LEFT])
{
if(curgrp > 0) curgrp--;
}
if(keypressed[VK_RIGHT])
{
if(curgrp < maptexgroup.len-1) curgrp++;
}
EndDrawing();
HandleWindow();
}
}
开发者ID:AdrienTD,项目名称:wkbre,代码行数:59,代码来源:test.cpp
示例8: main
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing");
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("some basic shapes available on raylib", 20, 20, 20, DARKGRAY);
DrawLine(18, 42, screenWidth - 18, 42, BLACK);
DrawCircle(screenWidth/4, 120, 35, DARKBLUE);
DrawCircleGradient(screenWidth/4, 220, 60, GREEN, SKYBLUE);
DrawCircleLines(screenWidth/4, 340, 80, DARKBLUE);
DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED);
DrawRectangleGradient(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD);
DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE);
DrawTriangle((Vector2){screenWidth/4*3, 80},
(Vector2){screenWidth/4*3 - 60, 150},
(Vector2){screenWidth/4*3 + 60, 150}, VIOLET);
DrawTriangleLines((Vector2){screenWidth/4*3, 160},
(Vector2){screenWidth/4*3 - 20, 230},
(Vector2){screenWidth/4*3 + 20, 230}, DARKBLUE);
DrawPoly((Vector2){screenWidth/4*3, 320}, 6, 80, 0, BROWN);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
开发者ID:Libertium,项目名称:raylib,代码行数:57,代码来源:shapes_basic_shapes.c
示例9: main
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [texture] example - texture rectangle");
const char textLine1[] = "Lena image is a standard test image which has been in use since 1973.";
const char textLine2[] = "It comprises 512x512 pixels, and it is probably the most widely used";
const char textLine3[] = "test image for all sorts of image processing algorithms.";
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D texture = LoadTexture("resources/lena.png"); // Texture loading
Rectangle eyesRec = { 225, 240, 155, 50 }; // Part of the texture to draw
Vector2 position = { 369, 241 };
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("LENA", 220, 100, 20, PINK);
DrawTexture(texture, screenWidth/2 - 256, 0, Fade(WHITE, 0.1f)); // Draw background image
DrawTextureRec(texture, eyesRec, position, WHITE); // Draw eyes part of image
DrawText(textLine1, 220, 140, 10, DARKGRAY);
DrawText(textLine2, 220, 160, 10, DARKGRAY);
DrawText(textLine3, 220, 180, 10, DARKGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
开发者ID:Libertium,项目名称:raylib,代码行数:57,代码来源:textures_rectangle.c
示例10: main
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 };
Vector2 gamepadMovement = { 0.0f, 0.0f };
SetTargetFPS(60); // Set target frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
{
gamepadMovement = GetGamepadMovement(GAMEPAD_PLAYER1);
ballPosition.x += gamepadMovement.x;
ballPosition.y -= gamepadMovement.y;
if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A))
{
ballPosition.x = (float)screenWidth/2;
ballPosition.y = (float)screenHeight/2;
}
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("move the ball with gamepad", 10, 10, 20, DARKGRAY);
DrawCircleV(ballPosition, 50, MAROON);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
开发者ID:AdanBB,项目名称:raylib,代码行数:56,代码来源:core_input_gamepad.c
示例11: DrawGame
// Draw game (one frame)
void DrawGame(void)
{
BeginDrawing();
ClearBackground(RAYWHITE);
if (!gameOver)
{
// Draw missiles
for (int i = 0; i < MAX_MISSILES; i++)
{
if (missile[i].active)
{
DrawLine(missile[i].origin.x, missile[i].origin.y, missile[i].position.x, missile[i].position.y, RED);
if (framesCounter % 16 < 8) DrawCircle(missile[i].position.x, missile[i].position.y, 3, YELLOW);
}
}
// Draw interceptors
for (int i = 0; i < MAX_INTERCEPTORS; i++)
{
if (interceptor[i].active)
{
DrawLine(interceptor[i].origin.x, interceptor[i].origin.y, interceptor[i].position.x, interceptor[i].position.y, GREEN);
if (framesCounter % 16 < 8) DrawCircle(interceptor[i].position.x, interceptor[i].position.y, 3, BLUE);
}
}
// Draw explosions
for (int i = 0; i < MAX_EXPLOSIONS; i++)
{
if (explosion[i].active) DrawCircle(explosion[i].position.x, explosion[i].position.y, EXPLOSION_RADIUS*explosion[i].radiusMultiplier, EXPLOSION_COLOR);
}
// Draw buildings and launchers
for (int i = 0; i < LAUNCHERS_AMOUNT; i++)
{
if (launcher[i].active) DrawRectangle(launcher[i].position.x - LAUNCHER_SIZE/2, launcher[i].position.y - LAUNCHER_SIZE/2, LAUNCHER_SIZE, LAUNCHER_SIZE, GRAY);
}
for (int i = 0; i < BUILDINGS_AMOUNT; i++)
{
if (building[i].active) DrawRectangle(building[i].position.x - BUILDING_SIZE/2, building[i].position.y - BUILDING_SIZE/2, BUILDING_SIZE, BUILDING_SIZE, LIGHTGRAY);
}
// Draw score
DrawText(FormatText("SCORE %4i", score), 20, 20, 40, LIGHTGRAY);
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, GRAY);
}
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, GRAY);
EndDrawing();
}
开发者ID:AdanBB,项目名称:raylib,代码行数:57,代码来源:missile_commander.c
示例12: Test5
void Test5()
{
LoadBCP("data.bcp");
ReadLanguageFile();
InitWindow();
LoadGameSet("Warrior Kings Game Set\\small extensions.cpp");
printf("Game set loaded!\n");
printf("Declared items:\n");
for(int i = 0; i < strItems.len; i++)
printf(" - %s\n", strItems[i]);
printf("Defined values:\n");
for(int i = 0; i < defvalue.len; i++)
printf(" - %s = %f\n", strDefValue[i], defvalue[i]);
printf("Appearance tags:\n");
for(int i = 0; i < strAppearTag.len; i++)
printf(" - %s\n", strAppearTag[i]);
printf("ObjDefs:\n");
for(int i = 0; i < strObjDef.len; i++)
printf(" - %s (%s)\n", strObjDef[i], CLASS_str[typeObjDef[i]]);
printf("Looking at first object:\n");
printf(" - Tooltip: %s\n", objdef[0].tooltip);
printf(" - First start item: %f\n", objdef[0].startItems[0]);
printf(" - Shadow: %i\n", objdef[0].shadowtype);
printf("2nd's subtypes:\n");
for(int i = 0; i < pstObjDef[1]->len; i++)
printf(" - %s\n", (pstObjDef[1])->getdp(i));
printf("1st's subtypes (%i):\n", pstObjDef[0]->len);
for(int i = 0; i < pstObjDef[0]->len; i++)
printf(" - %s\n", (pstObjDef[0])->getdp(i));
printf("These ObjDefs have \"Default\" subtype and \"Default\" appearance:\n");
for(int i = 0; i < strObjDef.len; i++)
printf("- %s: %s\n", strObjDef[i], objdef[i].subtypes[0].appear[0].def?"Yes":"No"); // :S
getch();
//InitMeshDrawing();
int a = FindObjDef(CLASS_BUILDING, "Manor");
while(!appexit)
{
BeginDrawing();
BeginMeshDrawing();
SetModelMatrices();
objdef[a].subtypes[0].appear[0].def->draw(); // :S
EndDrawing();
HandleWindow();
}
}
开发者ID:AdrienTD,项目名称:wkbre,代码行数:56,代码来源:test.cpp
示例13: main
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [text] example - bmfont and ttf sprite fonts loading");
const char msgBm[64] = "THIS IS AN AngelCode SPRITE FONT";
const char msgTtf[64] = "THIS SPRITE FONT has been GENERATED from a TTF";
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
SpriteFont fontBm = LoadSpriteFont("resources/fonts/bmfont.fnt"); // BMFont (AngelCode)
SpriteFont fontTtf = LoadSpriteFont("resources/fonts/pixantiqua.ttf"); // TTF font
Vector2 fontPosition;
fontPosition.x = screenWidth/2 - MeasureTextEx(fontBm, msgBm, fontBm.size, 0).x/2;
fontPosition.y = screenHeight/2 - fontBm.size/2 - 80;
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update variables here...
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawTextEx(fontBm, msgBm, fontPosition, fontBm.size, 0, MAROON);
DrawTextEx(fontTtf, msgTtf, (Vector2){ 75.0f, 240.0f }, fontTtf.size*0.8f, 2, LIME);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadSpriteFont(fontBm); // AngelCode SpriteFont unloading
UnloadSpriteFont(fontTtf); // TTF SpriteFont unloading
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
开发者ID:AdanBB,项目名称:raylib,代码行数:55,代码来源:text_bmfont_ttf.c
示例14: StartDrawing
void SpriteRenderer3D::DrawCache()
{
StartDrawing();
for (auto& s : sprites)
{
Draw(s);
}
EndDrawing();
}
开发者ID:altseed,项目名称:Altseed,代码行数:11,代码来源:asd.SpriteRenderer3D.cpp
示例15: Test21
void Test21()
{
InitWindow();
while(!appexit)
{
BeginDrawing();
EndDrawing();
HandleWindow();
Sleep(1000/30);
}
}
开发者ID:AdrienTD,项目名称:wkbre,代码行数:11,代码来源:test.cpp
示例16: Render
void ModelPreview::render( wxPaintEvent& event )
{
if(mIsDrawing) return;
//if(!mIsInitialized) { InitializeGLCanvas(); }
//SetCurrentGLContext();
//wxPaintDC(this); // only to be used in paint events. use wxClientDC to paint outside the paint event
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if(!StartDrawing(mPointSize)) return;
Render();
EndDrawing();
}
开发者ID:bagumondigi,项目名称:xLights,代码行数:12,代码来源:ModelPreview.cpp
示例17: main
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib test - texture pro");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
Vector2 position = { 200, 100 };
Rectangle sourceRec = { 128, 128, 128, 128 };
Rectangle destRec = { 128, 128, 128, 128 };
Vector2 origin = { 64, 64 }; // NOTE: origin is relative to destRec size
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
//DrawTextureEx(texture, position, 45, 1, MAROON);
DrawTexturePro(texture, sourceRec, destRec, origin, 45, GREEN);
DrawLine(destRec.x, 0, destRec.x, screenHeight, RED);
DrawLine(0, destRec.y, screenWidth, destRec.y, RED);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
开发者ID:Danlestal,项目名称:raylib,代码行数:53,代码来源:test_texture_pro.c
示例18: main
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib test - DDS texture loading and drawing");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
//Texture2D texture = LoadTexture("resources/raylib_logo.dds"); // Texture loading
//Texture2D texture = LoadTexture("resources/raylib_logo_uncompressed.dds"); // Texture loading
Image image = LoadImage("resources/raylib_logo_uncompressed.dds");
Texture2D texture = CreateTexture(image, false);
// NOTE: With OpenGL 3.3 mipmaps generation works great
SetTargetFPS(60);
//---------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
DrawText("this IS a texture!", 360, 370, 10, GRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
//UnloadTexture(texture); // Texture unloading
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
开发者ID:Danlestal,项目名称:raylib,代码行数:53,代码来源:test_textures_dds.c
示例19: main
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values");
int framesCounter = 0; // Variable used to count frames
int randValue = GetRandomValue(-8,5); // Get a random integer number between -8 and 5 (both included)
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
framesCounter++;
// Every two seconds (120 frames) a new random value is generated
if (((framesCounter/120)%2) == 1)
{
randValue = GetRandomValue(-8,5);
framesCounter = 0;
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
DrawText(FormatText("%i", randValue), 360, 180, 80, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
开发者ID:MarcMDE,项目名称:raylib,代码行数:52,代码来源:core_random_values.c
示例20: main
int main()
{
// Setup
int screenWidth = 800;
int screenHeight = 450;
InitWindow(
screenWidth, screenHeight, "raylib [network] example - udp server");
SetTargetFPS(60);
SetTraceLogLevel(LOG_DEBUG);
// Networking
InitNetwork();
// Create the server
//
// Performs
// getaddrinfo
// socket
// setsockopt
// bind
// listen
server_res = AllocSocketResult();
if (!SocketCreate(&server_cfg, server_res)) {
TraceLog(LOG_WARNING, "Failed to open server: status %d, errno %d",
server_res->status, server_res->socket->status);
} else {
if (!SocketBind(&server_cfg, server_res)) {
TraceLog(LOG_WARNING, "Failed to bind server: status %d, errno %d",
server_res->status, server_res->socket->status);
}
}
// Create & Add sockets to the socket set
socket_set = AllocSocketSet(1);
msglen = strlen(pingmsg) + 1;
memset(recvBuffer, '\0', sizeof(recvBuffer));
AddSocket(socket_set, server_res->socket);
// Main game loop
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(RAYWHITE);
NetworkUpdate();
EndDrawing();
}
// Cleanup
CloseWindow();
return 0;
}
开发者ID:raysan5,项目名称:raylib,代码行数:50,代码来源:network_udp_server.c
注:本文中的EndDrawing函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论