Skip to content

Commit

Permalink
bump pixelaw to 0.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
thiscaspar committed Nov 14, 2024
1 parent 78badc4 commit 6af154a
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "My Project",
"image": "ghcr.io/pixelaw/core:0.5.1",
"image": "ghcr.io/pixelaw/core:0.5.3",
"forwardPorts": [
5050,
8080,
Expand Down Expand Up @@ -32,7 +32,7 @@
// Set *default* container specific settings.json values on container create.
"settings": {
"cairo1.enableLanguageServer": true,
"cairo1.languageServerPath": "${userHome}/.asdf/installs/dojo/1.0.0-alpha.17/bin/dojo-language-server",
"cairo1.languageServerPath": "${userHome}/.asdf/installs/dojo/1.0.0/bin/dojo-language-server",
"cairo1.enableScarb": true,
"cairo1.scarbPath": "${userHome}/.asdf/installs/scarb/2.7.0/bin/scarb",
"lldb.executable": "/usr/bin/lldb",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"cairo1.enableLanguageServer": true,
"cairo1.languageServerPath": "${userHome}/.asdf/installs/dojo/1.0.0-alpha.17/bin/dojo-language-server",
"cairo1.languageServerPath": "${userHome}/.asdf/installs/dojo/1.0.0/bin/dojo-language-server",
"cairo1.enableScarb": true,
"cairo1.scarbPath": "${userHome}/.asdf/installs/scarb/2.7.0/bin/scarb",
"cairo1.preferScarbLanguageServer": false
Expand Down
16 changes: 12 additions & 4 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ version = 1

[[package]]
name = "dojo"
version = "1.0.0-alpha.4"
source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.17#e6bab2d0066c3cf1acfc5ee41a27294b5b23697d"
version = "1.0.0"
source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0#74280d48fa2828095331487dede59f9b2e378cd3"
dependencies = [
"dojo_plugin",
]

[[package]]
name = "dojo_plugin"
version = "2.8.4"
source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0#74280d48fa2828095331487dede59f9b2e378cd3"

[[package]]
name = "myapp"
Expand All @@ -16,8 +24,8 @@ dependencies = [

[[package]]
name = "pixelaw"
version = "0.4.4"
source = "git+https://github.com/pixelaw/core?tag=v0.4.5#cf8fb1b426c8580216dddd649ad1da8a9f0e6dcd"
version = "0.5.2"
source = "git+https://github.com/pixelaw/core?tag=v0.5.2#22eec50675dd440a1bf183283a6d16effff866bf"
dependencies = [
"dojo",
]
10 changes: 6 additions & 4 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
[package]
cairo-version = "=2.7.0"
cairo-version = "=2.8.4"
name = "myapp"
version = "0.0.0"

[cairo]
sierra-replace-ids = true

[dependencies]
pixelaw = { git = "https://github.com/pixelaw/core", tag = "v0.4.6" }
pixelaw = { git = "https://github.com/pixelaw/core", tag = "v0.5.3" }
# pixelaw = { path = "../core/contracts" }


dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.17" }
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0" }

[[target.dojo]]
[[target.starknet-contract]]
sierra = true
build-external-contracts = [
"dojo::world::world_contract::world",
"pixelaw::apps::snake::app::snake",
"pixelaw::apps::snake::app::snake_segment",
"pixelaw::core::models::area::area",
Expand Down
10 changes: 0 additions & 10 deletions overlays/dev/core_actions.toml

This file was deleted.

30 changes: 17 additions & 13 deletions src/app.cairo
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
use dojo::world::{IWorldDispatcher, IWorldDispatcherTrait};

use pixelaw::core::utils::{DefaultParameters};


#[dojo::interface]
pub trait IMyAppActions<TContractState> {
fn init(ref world: IWorldDispatcher);
fn interact(ref world: IWorldDispatcher, default_params: DefaultParameters);
#[starknet::interface]
pub trait IMyAppActions<T> {
fn init(ref self: T);
fn interact(ref self: T, default_params: DefaultParameters);
}

/// contracts must be named as such (APP_KEY + underscore + "actions")
#[dojo::contract(namespace: "pixelaw", nomapping: true)]
#[dojo::contract]
pub mod myapp_actions {
use dojo::model::{ModelStorage};
use debug::PrintTrait;
use myapp::constants::{APP_KEY, APP_ICON};
use pixelaw::core::actions::{
Expand All @@ -32,9 +33,10 @@ pub mod myapp_actions {
// impl: implement functions specified in trait
#[abi(embed_v0)]
impl ActionsImpl of IMyAppActions<ContractState> {
/// Initialize the MyApp App (TODO I think, do we need this??)
fn init(ref world: IWorldDispatcher) {
let core_actions = pixelaw::core::utils::get_core_actions(world);
/// Initialize the MyApp App
fn init(ref self: ContractState) {
let mut world = self.world(@"pixelaw");
let core_actions = pixelaw::core::utils::get_core_actions(ref world);
core_actions.new_app(contract_address_const::<0>(), APP_KEY, APP_ICON);
}

Expand All @@ -44,14 +46,16 @@ pub mod myapp_actions {
///
/// * `position` - Position of the pixel.
/// * `new_color` - Color to set the pixel to.
fn interact(ref world: IWorldDispatcher, default_params: DefaultParameters) {
fn interact(ref self: ContractState, default_params: DefaultParameters) {
let mut world = self.world(@"pixelaw");
// Load important variables
let core_actions = get_core_actions(world);
let core_actions = get_core_actions(ref world);
let position = default_params.position;
let (player, system) = get_callers(world, default_params);
let (player, system) = get_callers(ref world, default_params);

// Load the Pixel
let mut pixel = get!(world, (position.x, position.y), (Pixel));

let mut pixel: Pixel = world.read_model((position.x, position.y));

// TODO: Load MyApp App Settings like the fade steptime
// For example for the Cooldown feature
Expand Down

0 comments on commit 6af154a

Please sign in to comment.