-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
147 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "vita-example-sdl-gles" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
license = "MIT OR Apache-2.0" | ||
repository = "https://github.com/vita-rust/examples" | ||
homepage = "https://github.com/vita-rust/examples/crates/4-vitasdk" | ||
|
||
description = "VITASDK example" | ||
|
||
[dependencies] | ||
rand = "0.8.5" | ||
gl = "0.10.0" | ||
sdl2 = { version = "0.35.2", features = ["use-pkgconfig"] } | ||
|
||
[package.metadata.vita] | ||
title_id = "RUSTTEST5" | ||
title_name = "SDL+GL test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#[link(name = "SDL2", kind = "static")] | ||
#[link(name = "vitaGL", kind = "static")] | ||
#[link(name = "vitashark", kind = "static")] | ||
#[link(name = "SceShaccCg_stub", kind = "static")] | ||
#[link(name = "mathneon", kind = "static")] | ||
#[link(name = "SceShaccCgExt", kind = "static")] | ||
#[link(name = "taihen_stub", kind = "static")] | ||
#[link(name = "SceKernelDmacMgr_stub", kind = "static")] | ||
#[link(name = "SceIme_stub", kind = "static")] | ||
extern "C" {} | ||
|
||
fn main() { | ||
let sdl = sdl2::init().unwrap(); | ||
let video_subsystem = sdl.video().unwrap(); | ||
let window = video_subsystem | ||
.window("Game", 900, 700) | ||
.opengl() | ||
.build() | ||
.unwrap(); | ||
|
||
let _gl_context = window.gl_create_context().unwrap(); | ||
let _gl = gl::load_with(|s| video_subsystem.gl_get_proc_address(s) as *const std::os::raw::c_void); | ||
|
||
unsafe { | ||
gl::ClearColor(0.3, 0.3, 0.5, 1.0); | ||
} | ||
|
||
let mut event_pump = sdl.event_pump().unwrap(); | ||
'main: loop { | ||
for event in event_pump.poll_iter() { | ||
match event { | ||
sdl2::event::Event::Quit {..} => break 'main, | ||
_ => {}, | ||
} | ||
} | ||
|
||
unsafe { | ||
gl::Clear(gl::COLOR_BUFFER_BIT); | ||
} | ||
|
||
window.gl_swap_window(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
pkgname=sdl2 | ||
pkgver=2.30.2 | ||
pkgrel=1 | ||
gitrev=0867aceb28a493b489f54a3407a3b820b092206a | ||
url='https://www.libsdl.org' | ||
source=( | ||
"https://github.com/Northfear/SDL/archive/${gitrev}.tar.gz" | ||
) | ||
sha256sums=( | ||
SKIP | ||
) | ||
|
||
prepare() { | ||
cd "SDL-${gitrev}" | ||
} | ||
|
||
build() { | ||
cd "SDL-${gitrev}" | ||
mkdir build && cd build | ||
cmake .. -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_BUILD_TYPE=Release -DSDL_TEST=OFF -DVIDEO_VITA_VGL=ON | ||
make -j$(nproc) | ||
} | ||
|
||
package () { | ||
cd "SDL-${gitrev}" | ||
cd build | ||
make DESTDIR=$pkgdir install | ||
} |