新ぴたぶろぐ
自分が書きたいことを書くだけのブログ
≡
検索
AND検索
OR検索
↑
プロフィール
Pitan
プログラミングや音MADやらが趣味
↑
最新のページ
最新の5件
2025-03-28
ActionsからPackagesへPublishしようとしてもForbiddenとかUnauthorizedで失敗する
2025-03-20
ユーザー単位での共通の gradle.properties
2025-03-18
GitHub Pagesの解除方法
今使っているものについてまとめる2025
2025-03-13
MMDのプラグインまとめ
[
もっと見る
]
↑
タグ
Java
Minecraft
ゲーム
プログラミング
情報技術
[
もっと見る
]
↑
人気のページ
人気の5件
FrontPage
(39793)
【Discord】強力なスパム対策ができるボット「Wick」を紹介します。
(1678)
RecentUpdates
(1504)
【Minecraft】 FabricとForgeどっちがいいのだろうか?
(769)
無料のWikiソフトウェアを比較してみる
(374)
↑
カウンター
合計:
0
今日:
0
昨日:
0
オンライン:
2
トップ
ヘルプ
PukiWiki
20220728158 をテンプレートにして作成
開始行:
#include(include/oldblog,notitle)
&ref(https://blog.pitan76.net/wp-content/uploads/2022/07/...
* 【LWJGL3】ウィンドウの作成 #1 [#title]
#splitbody{{
LEFT:
&tag(情報技術,プログラミング,Java,LWJGL,LWJGL3);
#split
RIGHT:&size(13){投稿日: 2022-07-28 (木)};
}}
#bcontents
適当に初期クラスのMainクラスとウィンドウの処理を書くため...
- Windowクラス
package ml.pkom.lwjgl.tutorial;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.glfw.GLFWVidMode;
import static org.lwjgl.system.MemoryUtil.*;
public class Window {
public long window;
// ウィンドウの横幅
public int width = 640;
// ウィンドウの縦幅
public int height = 360;
// ウィンドウのタイトル名
public String title = "HogeHoge";
public void init() {
// GLFWの初期化
GLFW.glfwInit();
// ウィンドウを作成
window = GLFW.glfwCreateWindow(width, height, ti...
// ウィンドウが見えるように設定
GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, GLFW.GLFW...
// リサイズをできるように設定
GLFW.glfwWindowHint(GLFW.GLFW_RESIZABLE, GLFW.GL...
// ビデオモードの取得
GLFWVidMode videoMode = GLFW.glfwGetVideoMode(GL...
// 画面のサイズを取得
int screenWidth = videoMode.width();
int screenHeight = videoMode.height();
// ウィンドウの位置を中央へセットする
GLFW.glfwSetWindowPos(window, (screenWidth - wid...
// ウィンドウを表示
GLFW.glfwShowWindow(window);
}
// 閉じるボタンが押されるとtrueを返す
public boolean isClosed() {
return GLFW.glfwWindowShouldClose(window);
}
public void update() {
// マウスなど入力されたイベントを記録する
GLFW.glfwPollEvents();
}
public void swapBuffers() {
// カラーバッファ(色表示)を入れ替える
GLFW.glfwSwapBuffers(window);
}
}
- Mainクラス
package ml.pkom.lwjgl.tutorial;
public class Main {
public static void main(String[] args) {
Window window = new Window();
// ウィンドウの初期化
window.init();
// 閉じるまでループ
while (!window.isClosed()) {
// イベントの更新
window.update();
// バッファの更新
window.swapBuffers();
}
}
}
&ref(https://blog.pitan76.net/wp-content/uploads/2022/07/...
実行してみるとウィンドウが表示されました。
** コメント [#comment]
#pctrlcmt
&size(10){キーワード: 描画ライブラリ, アプリ開発, アプリ...
終了行:
#include(include/oldblog,notitle)
&ref(https://blog.pitan76.net/wp-content/uploads/2022/07/...
* 【LWJGL3】ウィンドウの作成 #1 [#title]
#splitbody{{
LEFT:
&tag(情報技術,プログラミング,Java,LWJGL,LWJGL3);
#split
RIGHT:&size(13){投稿日: 2022-07-28 (木)};
}}
#bcontents
適当に初期クラスのMainクラスとウィンドウの処理を書くため...
- Windowクラス
package ml.pkom.lwjgl.tutorial;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.glfw.GLFWVidMode;
import static org.lwjgl.system.MemoryUtil.*;
public class Window {
public long window;
// ウィンドウの横幅
public int width = 640;
// ウィンドウの縦幅
public int height = 360;
// ウィンドウのタイトル名
public String title = "HogeHoge";
public void init() {
// GLFWの初期化
GLFW.glfwInit();
// ウィンドウを作成
window = GLFW.glfwCreateWindow(width, height, ti...
// ウィンドウが見えるように設定
GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, GLFW.GLFW...
// リサイズをできるように設定
GLFW.glfwWindowHint(GLFW.GLFW_RESIZABLE, GLFW.GL...
// ビデオモードの取得
GLFWVidMode videoMode = GLFW.glfwGetVideoMode(GL...
// 画面のサイズを取得
int screenWidth = videoMode.width();
int screenHeight = videoMode.height();
// ウィンドウの位置を中央へセットする
GLFW.glfwSetWindowPos(window, (screenWidth - wid...
// ウィンドウを表示
GLFW.glfwShowWindow(window);
}
// 閉じるボタンが押されるとtrueを返す
public boolean isClosed() {
return GLFW.glfwWindowShouldClose(window);
}
public void update() {
// マウスなど入力されたイベントを記録する
GLFW.glfwPollEvents();
}
public void swapBuffers() {
// カラーバッファ(色表示)を入れ替える
GLFW.glfwSwapBuffers(window);
}
}
- Mainクラス
package ml.pkom.lwjgl.tutorial;
public class Main {
public static void main(String[] args) {
Window window = new Window();
// ウィンドウの初期化
window.init();
// 閉じるまでループ
while (!window.isClosed()) {
// イベントの更新
window.update();
// バッファの更新
window.swapBuffers();
}
}
}
&ref(https://blog.pitan76.net/wp-content/uploads/2022/07/...
実行してみるとウィンドウが表示されました。
** コメント [#comment]
#pctrlcmt
&size(10){キーワード: 描画ライブラリ, アプリ開発, アプリ...
ページ名:
検索
AND検索
OR検索
↑
プロフィール
Pitan
プログラミングや音MADやらが趣味
↑
最新のページ
最新の5件
2025-03-28
ActionsからPackagesへPublishしようとしてもForbiddenとかUnauthorizedで失敗する
2025-03-20
ユーザー単位での共通の gradle.properties
2025-03-18
GitHub Pagesの解除方法
今使っているものについてまとめる2025
2025-03-13
MMDのプラグインまとめ
[
もっと見る
]
↑
タグ
Java
Minecraft
ゲーム
プログラミング
情報技術
[
もっと見る
]
↑
人気のページ
人気の5件
FrontPage
(39793)
【Discord】強力なスパム対策ができるボット「Wick」を紹介します。
(1678)
RecentUpdates
(1504)
【Minecraft】 FabricとForgeどっちがいいのだろうか?
(769)
無料のWikiソフトウェアを比較してみる
(374)
↑
カウンター
合計:
0
今日:
0
昨日:
0
オンライン:
2